Skip to content

Commit 983f464

Browse files
newrengitster
authored andcommitted
git-rebase.txt: address confusion between --no-ff vs --force-rebase
rebase was taught the --force-rebase option in commit b2f82e0 ("Teach rebase to rebase even if upstream is up to date", 2009-02-13). This flag worked for the am and merge backends, but wasn't a valid option for the interactive backend. rebase was taught the --no-ff option for interactive rebases in commit b499549 ("Teach rebase the --no-ff option.", 2010-03-24), to do the exact same thing as --force-rebase does for non-interactive rebases. This commit explicitly documented the fact that --force-rebase was incompatible with --interactive, though it made --no-ff a synonym for --force-rebase for non-interactive rebases. The choice of a new option was based on the fact that "force rebase" didn't sound like an appropriate term for the interactive machinery. In commit 6bb4e48 ("rebase: align variable names", 2011-02-06), the separate parsing of command line options in the different rebase scripts was removed, and whether on accident or because the author noticed that these options did the same thing, the options became synonyms and both were accepted by all three rebase types. In commit 2d26d53 ("Documentation/git-rebase.txt: -f forces a rebase that would otherwise be a no-op", 2014-08-12), which reworded the description of the --force-rebase option, the (no-longer correct) sentence stating that --force-rebase was incompatible with --interactive was finally removed. Finally, as explained at https://public-inbox.org/git/[email protected] In the original discussion around this option [1], at one point I proposed teaching rebase--interactive to respect --force-rebase instead of adding a new option [2]. Ultimately --no-ff was chosen as the better user interface design [3], because an interactive rebase can't be "forced" to run. We have accepted both --no-ff and --force-rebase as full synonyms for all three rebase types for over seven years. Documenting them differently and in ways that suggest they might not be quite synonyms simply leads to confusion. Adjust the documentation to match reality. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c840e1a commit 983f464

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

Documentation/git-rebase.txt

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -337,16 +337,18 @@ See also INCOMPATIBLE OPTIONS below.
337337
+
338338
See also INCOMPATIBLE OPTIONS below.
339339

340-
-f::
340+
--no-ff::
341341
--force-rebase::
342-
Force a rebase even if the current branch is up to date and
343-
the command without `--force` would return without doing anything.
342+
-f::
343+
Individually replay all rebased commits instead of fast-forwarding
344+
over the unchanged ones. This ensures that the entire history of
345+
the rebased branch is composed of new commits.
344346
+
345-
You may find this (or --no-ff with an interactive rebase) helpful after
346-
reverting a topic branch merge, as this option recreates the topic branch with
347-
fresh commits so it can be remerged successfully without needing to "revert
348-
the reversion" (see the
349-
link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details).
347+
You may find this helpful after reverting a topic branch merge, as this option
348+
recreates the topic branch with fresh commits so it can be remerged
349+
successfully without needing to "revert the reversion" (see the
350+
link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for
351+
details).
350352

351353
--fork-point::
352354
--no-fork-point::
@@ -498,18 +500,6 @@ See also INCOMPATIBLE OPTIONS below.
498500
with care: the final stash application after a successful
499501
rebase might result in non-trivial conflicts.
500502

501-
--no-ff::
502-
With --interactive, cherry-pick all rebased commits instead of
503-
fast-forwarding over the unchanged ones. This ensures that the
504-
entire history of the rebased branch is composed of new commits.
505-
+
506-
Without --interactive, this is a synonym for --force-rebase.
507-
+
508-
You may find this helpful after reverting a topic branch merge, as this option
509-
recreates the topic branch with fresh commits so it can be remerged
510-
successfully without needing to "revert the reversion" (see the
511-
link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details).
512-
513503
INCOMPATIBLE OPTIONS
514504
--------------------
515505

0 commit comments

Comments
 (0)