Skip to content

Commit f51a48e

Browse files
sorganovgitster
authored andcommitted
Documentation/git-rebase.txt: document when --fork-point is auto-enabled
Running "git rebase" without giving a specific commit with respect to which the operation is done enables --fork-point mode, while telling the command to rebase with respect to a specific commit, i.e. "git rebase <upstream>" does not. This was not mentioned in the DESCRIPTION section of the manual page, even though the case of omitted <upstream> was otherwise discussed. That in turn made actual behavior of vanilla "git rebase" hardly discoverable. While we are at it, clarify the --fork-point description itself as well. Signed-off-by: Sergey Organov <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d31f3ad commit f51a48e

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

Documentation/git-rebase.txt

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ If <branch> is specified, 'git rebase' will perform an automatic
2121
it remains on the current branch.
2222

2323
If <upstream> is not specified, the upstream configured in
24-
branch.<name>.remote and branch.<name>.merge options will be used; see
25-
linkgit:git-config[1] for details. If you are currently not on any
26-
branch or if the current branch does not have a configured upstream,
27-
the rebase will abort.
24+
branch.<name>.remote and branch.<name>.merge options will be used (see
25+
linkgit:git-config[1] for details) and the `--fork-point` option is
26+
assumed. If you are currently not on any branch or if the current
27+
branch does not have a configured upstream, the rebase will abort.
2828

2929
All changes made by commits in the current branch but that are not
3030
in <upstream> are saved to a temporary area. This is the same set
31-
of commits that would be shown by `git log <upstream>..HEAD` (or
32-
`git log HEAD`, if --root is specified).
31+
of commits that would be shown by `git log <upstream>..HEAD`; or by
32+
`git log 'fork_point'..HEAD`, if `--fork-point` is active (see the
33+
description on `--fork-point` below); or by `git log HEAD`, if the
34+
`--root` option is specified.
3335

3436
The current branch is reset to <upstream>, or <newbase> if the
3537
--onto option was supplied. This has the exact same effect as
@@ -326,13 +328,18 @@ link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details)
326328

327329
--fork-point::
328330
--no-fork-point::
329-
Use 'git merge-base --fork-point' to find a better common ancestor
330-
between `upstream` and `branch` when calculating which commits have
331-
have been introduced by `branch` (see linkgit:git-merge-base[1]).
331+
Use reflog to find a better common ancestor between <upstream>
332+
and <branch> when calculating which commits have been
333+
introduced by <branch>.
332334
+
333-
If no non-option arguments are given on the command line, then the default is
334-
`--fork-point @{u}` otherwise the `upstream` argument is interpreted literally
335-
unless the `--fork-point` option is specified.
335+
When --fork-point is active, 'fork_point' will be used instead of
336+
<upstream> to calculate the set of commits to rebase, where
337+
'fork_point' is the result of `git merge-base --fork-point <upstream>
338+
<branch>` command (see linkgit:git-merge-base[1]). If 'fork_point'
339+
ends up being empty, the <upstream> will be used as a fallback.
340+
+
341+
If either <upstream> or --root is given on the command line, then the
342+
default is `--no-fork-point`, otherwise the default is `--fork-point`.
336343

337344
--ignore-whitespace::
338345
--whitespace=<option>::

0 commit comments

Comments
 (0)