Documentation/git-rebase.txt: discuss --fork-point assumption of vanilla "git rebase" in DESCRIPTION.
PATCH 1/1 Documentation/git-rebase.txt: discuss --fork-point assumption of vanilla "git rebase" in DESCRIPTION.
Vanilla "git rebase" defaults to --fork-point that in some cases makes behavior very different from "git rebase <upstream>", where --no-fork-point is assumed. This fact 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.
--- Documentation/git-rebase.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
Documentation/git-rebase.txt +9 -9
@@ -21,15 +21,16 @@ If <branch> is specified, 'git rebase' will perform an automatic it remains on the current branch. If <upstream> is not specified, the upstream configured in -branch.<name>.remote and branch.<name>.merge options will be used; see -linkgit:git-config[1] for details. If you are currently not on any -branch or if the current branch does not have a configured upstream, -the rebase will abort. +branch.<name>.remote and branch.<name>.merge options will be used (see +linkgit:git-config[1] for details) and the `--fork-point` option is +assumed. If you are currently not on any branch or if the current +branch does not have a configured upstream, the rebase will abort. All changes made by commits in the current branch but that are not in <upstream> are saved to a temporary area. This is the same set -of commits that would be shown by `git log <upstream>..HEAD` (or -`git log HEAD`, if --root is specified). +of commits that would be shown by `git log <upstream>..HEAD`; or by +`git log <fork_point>..HEAD`, if --fork-point is either specified or +assumed; or by `git log HEAD`, if --root is specified. The current branch is reset to <upstream>, or <newbase> if the --onto option was supplied. This has the exact same effect as
@@ -331,9 +332,8 @@ link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details) between `upstream` and `branch` when calculating which commits have have been introduced by `branch` (see linkgit:git-merge-base[1]). + -If no non-option arguments are given on the command line, then the default is -`--fork-point @{u}` otherwise the `upstream` argument is interpreted literally -unless the `--fork-point` option is specified. +If either <upstream> or --root is given on the command line, then the +default is `--no-fork-point`, otherwise the default is `--fork-point`. --ignore-whitespace:: --whitespace=<option>::
Signature · 1 line
1.9.3
Quoted 20 lines · Sergey Organov
Vanilla "git rebase" defaults to --fork-point that in some cases makes behavior very different from "git rebase <upstream>", where --no-fork-point is assumed. This fact 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]>--- Documentation/git-rebase.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)Documentation/git-rebase.txt +0
-0@@ -21,15 +21,16 @@ If <branch> is specified, 'git rebase' will perform an automatic it remains on the current branch.
Documentation/git-rebase.txt If <branch> is specified, 'git rebase' will perform an automatic · line 27
Quoted 10 lines
Documentation/git-rebase.txt +4
-4If <upstream> is not specified, the upstream configured in -branch.<name>.remote and branch.<name>.merge options will be used; see -linkgit:git-config[1] for details. If you are currently not on any -branch or if the current branch does not have a configured upstream, -the rebase will abort. +branch.<name>.remote and branch.<name>.merge options will be used (see +linkgit:git-config[1] for details) and the `--fork-point` option is +assumed. If you are currently not on any branch or if the current +branch does not have a configured upstream, the rebase will abort.
OK. When you do not tell rebase with respect to what exact _commit_ the operation is to be done, then we will enable --fork-point, which makes perfect sense because it is clear that the user is rebasing with respect to a _branch_, for which we may find a place better than its current tip to rebase onto if we look at its reflog.
It is debatable if we should do the same when the user tells us to rebase with respect to a specific _branch_ by giving the 'upstream' argument, but that is an entirely separate issue. We might want to do a similar command line heuristics to tell between the branch switching "git checkout master" (which is an operation about a branch) and head detaching "git checkout refs/heads/master^0" (which is an operation about a commit) if we want to help the users by auto-enabling fork-point mode.
Documentation/git-rebase.txt If <branch> is specified, 'git rebase' will perform an automatic · line 33
Quoted 7 lines
Documentation/git-rebase.txt +3
-2All changes made by commits in the current branch but that are not in <upstream> are saved to a temporary area. This is the same set -of commits that would be shown by `git log <upstream>..HEAD` (or -`git log HEAD`, if --root is specified). +of commits that would be shown by `git log <upstream>..HEAD`; or by +`git log <fork_point>..HEAD`, if --fork-point is either specified or +assumed; or by `git log HEAD`, if --root is specified.
OK. <fork_point> is a new term this patch introduces to this document. Do we define what it is anywhere in this document, or would it help the readers to add something like "... where <fork_point> is computed in such and such way (see ... for details)"?
Documentation/git-rebase.txt link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details) · line 336
Quoted 9 lines
Documentation/git-rebase.txt +2
-3@@ -331,9 +332,8 @@ link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details) between `upstream` and `branch` when calculating which commits have have been introduced by `branch` (see linkgit:git-merge-base[1]). + -If no non-option arguments are given on the command line, then the default is -`--fork-point @{u}` otherwise the `upstream` argument is interpreted literally -unless the `--fork-point` option is specified. +If either <upstream> or --root is given on the command line, then the +default is `--no-fork-point`, otherwise the default is `--fork-point`.
Good. The original, especially the mention of "@{u}", does not make any sense and updated text reads more clearly.
Thanks.
Quoted 23 lines · Junio C Hamano
Quoted 21 lines · Sergey Organov
Vanilla "git rebase" defaults to --fork-point that in some cases makes behavior very different from "git rebase <upstream>", where --no-fork-point is assumed. This fact 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]>--- Documentation/git-rebase.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)Documentation/git-rebase.txt +0
-0@@ -21,15 +21,16 @@ If <branch> is specified, 'git rebase' will perform an automatic it remains on the current branch.
Quoted 15 lines
Documentation/git-rebase.txt If <branch> is specified, 'git rebase' will perform an automatic · line 27
Quoted 9 lines
Documentation/git-rebase.txt +4
-4If <upstream> is not specified, the upstream configured in -branch.<name>.remote and branch.<name>.merge options will be used; see -linkgit:git-config[1] for details. If you are currently not on any -branch or if the current branch does not have a configured upstream, -the rebase will abort. +branch.<name>.remote and branch.<name>.merge options will be used (see +linkgit:git-config[1] for details) and the `--fork-point` option is +assumed. If you are currently not on any branch or if the current +branch does not have a configured upstream, the rebase will abort.OK. When you do not tell rebase with respect to what exact _commit_ the operation is to be done, then we will enable --fork-point, which makes perfect sense because it is clear that the user is rebasing with respect to a _branch_, for which we may find a place better than its current tip to rebase onto if we look at its reflog.
I think you meant to say that we may find a better source to calculate the exact set of commits to rebase, as we still rebase onto the current tip. I.e., with this we select what to rebase, not where (the latter being handled by the --onto switch.)
Quoted 8 lines
It is debatable if we should do the same when the user tells us to rebase with respect to a specific _branch_ by giving the 'upstream' argument, but that is an entirely separate issue. We might want to do a similar command line heuristics to tell between the branch switching "git checkout master" (which is an operation about a branch) and head detaching "git checkout refs/heads/master^0" (which is an operation about a commit) if we want to help the users by auto-enabling fork-point mode.
Well, IMHO "git rebase" and "git rebase @{u}" must do exactly the same thing. In its current state, when they have different default for fork-point, it's too surprising. From this POV I do like suggested heuristics to activate --fork-point when <upstream> (either specified or figured from configuration) is a branch. However, it seems that this would be functionally equivalent to just making the --fork-point the default, unconditionally, as trying to find better fork-point in a reflog for a non-reference will bring nothing anyway. The heuristics could be considered an optimization, but it would optimize very rare case.
On the other hand, I'm afraid different defaults were chosen for backward compatibility?
Quoted 4 lines
Quoted 4 lines
Documentation/git-rebase.txt +0
-2All changes made by commits in the current branch but that are not in <upstream> are saved to a temporary area. This is the same set -of commits that would be shown by `git log <upstream>..HEAD` (or -`git log HEAD`, if --root is specified).
Quoted 8 lines
Documentation/git-rebase.txt If <branch> is specified, 'git rebase' will perform an automatic · line 33
Quoted 3 lines
Documentation/git-rebase.txt +3
-0+of commits that would be shown by `git log <upstream>..HEAD`; or by +`git log <fork_point>..HEAD`, if --fork-point is either specified or +assumed; or by `git log HEAD`, if --root is specified.OK. <
fork_point> is a new term this patch introduces to this document. Do we define what it is anywhere in this document, or would it help the readers to add something like "... where <fork_point> is computed in such and such way (see ... for details)"?
Yes, it's new and is not defined, but first I didn't want to overload the DESCRIPTION with details, and second I don't know how it's actually done, as it seems that "fork_point=$(git merge-base <upstream> <branch>)" sometimes returns nothing, in which case fork_point is set back to <upstream>? If we are going to describe it, I think it should go to --fork-point option description.
Could you please suggest the wording?
Quoted 14 lines
Documentation/git-rebase.txt link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details) · line 336
Quoted 10 lines
Documentation/git-rebase.txt +2
-3@@ -331,9 +332,8 @@ link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details) between `upstream` and `branch` when calculating which commits have have been introduced by `branch` (see linkgit:git-merge-base[1]). + -If no non-option arguments are given on the command line, then the default is -`--fork-point @{u}` otherwise the `upstream` argument is interpreted literally -unless the `--fork-point` option is specified. +If either <upstream> or --root is given on the command line, then the +default is `--no-fork-point`, otherwise the default is `--fork-point`.Good. The original, especially the mention of "@{u}", does not make any sense and updated text reads more clearly.
Quoted 1 line
Thanks.
BR,
-- Sergey.
Quoted 2 lines · Sergey Organov
I think you meant to say that we may find a better source to calculate the exact set of commits to rebase,...
Yes.
Quoted 11 lines
Quoted 8 lines
It is debatable if we should do the same when the user tells us to rebase with respect to a specific _branch_ by giving the 'upstream' argument, but that is an entirely separate issue. We might want to do a similar command line heuristics to tell between the branch switching "git checkout master" (which is an operation about a branch) and head detaching "git checkout refs/heads/master^0" (which is an operation about a commit) if we want to help the users by auto-enabling fork-point mode.
Well, IMHO "git rebase" and "git rebase @{u}" must do exactly the same thing.
"That is not part of the current discussion" is what I meant by "It is debatable... We might want to". There is no such patch to "git rebase" itself in this topic ;-).
With the "We might want to", I mean "git rebase", "git rebase @{u}" and "git rebase origin/master" (if your @{u} happens to be that branch) may want to do exactly the same thing. The last one however is very questionable, as sometimes you would want the --fork-point heuristics, and some other times you would want no digging of the reflogs involved (i.e. "I want everything not in this _exact_ commit to be rebased").
Quoted 2 lines
On the other hand, I'm afraid different defaults were chosen for backward compatibility?
There is no backward compatibility issue involved with the current behaviour. Changing it _will_ break compatibility, of course.
It is more like the command used not to guess with fork-point at all, i.e. we liked its exactness, but "git rebase" (no argument) case is so obviously not about an exact commit but is about branch that it is safe to use --fork-point guess without being confusing. Once you start giving the commit/branch with respect to which you conduct your rebase, it no longer is so cut-and-dried obvious that by "git rebase @{u}" if the user wants us to guess by digging the reflog of @{u} to find a better fork point, or if the user wants to do an exact rebase with respect to the commit at the tip of that branch.
Quoted 16 lines · Junio C Hamano
Quoted 2 lines · Sergey Organov
I think you meant to say that we may find a better source to calculate the exact set of commits to rebase,...
Yes.
Quoted 9 lines
Quoted 8 lines
It is debatable if we should do the same when the user tells us to rebase with respect to a specific _branch_ by giving the 'upstream' argument, but that is an entirely separate issue. We might want to do a similar command line heuristics to tell between the branch switching "git checkout master" (which is an operation about a branch) and head detaching "git checkout refs/heads/master^0" (which is an operation about a commit) if we want to help the users by auto-enabling fork-point mode.
Quoted 6 lines
Quoted 2 lines
Well, IMHO "git rebase" and "git rebase @{u}" must do exactly the same thing.
"That is not part of the current discussion" is what I meant by "It is debatable... We might want to". There is no such patch to "git rebase" itself in this topic ;-).
Yes, but to suggest better documentation I figure I need to understand all the related issues, so it is still somewhat relevant.
Quoted 11 lines
With the "We might want to", I mean "git rebase", "git rebase @{u}" and "git rebase origin/master" (if your @{u} happens to be that branch) may want to do exactly the same thing. The last one however is very questionable, as sometimes you would want the --fork-point heuristics, and some other times you would want no digging of the reflogs involved (i.e. "I want everything not in this _exact_ commit to be rebased").
Quoted 2 lines
On the other hand, I'm afraid different defaults were chosen for backward compatibility?
Quoted 7 lines
There is no backward compatibility issue involved with the current behaviour. Changing it _will_ break compatibility, of course.
It is more like the command used not to guess with fork-point at all, i.e. we liked its exactness, but "git rebase" (no argument) case is so obviously not about an exact commit but is about branch that it is safe to use --fork-point guess without being confusing.
Well, that's exactly what ended-up being /extremely/ confusing in my case.
Quoted 6 lines
Once you start giving the commit/branch with respect to which you conduct your rebase, it no longer is so cut-and-dried obvious that by "git rebase @{u}" if the user wants us to guess by digging the reflog of @{u} to find a better fork point, or if the user wants to do an exact rebase with respect to the commit at the tip of that branch.
Whatever excuses are, to me it still looks entirely unnatural that 'git rebase' and 'git rebase @{u}' mean almost the same /except/ the default value of --fork-point is different, sorry.
P.S. I'll prepare improved patch for the documentation shortly.
Signature · 1 line
Segey.
PATCH v2 1/1 Documentation/git-rebase.txt: discuss --fork-point assumption of vanilla "git rebase" in DESCRIPTION.
In reply to Sergey OrganovVanilla "git rebase" defaults to --fork-point that in some cases makes behavior very different from "git rebase <upstream>", where --no-fork-point is assumed. This fact 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.
---
As asked by Junio C Hamano <[email protected]>, the newly introduced 'fork_point' term has been described.
Documentation/git-rebase.txt | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-)
Documentation/git-rebase.txt +19 -12
@@ -21,15 +21,17 @@ If <branch> is specified, 'git rebase' will perform an automatic it remains on the current branch. If <upstream> is not specified, the upstream configured in -branch.<name>.remote and branch.<name>.merge options will be used; see -linkgit:git-config[1] for details. If you are currently not on any -branch or if the current branch does not have a configured upstream, -the rebase will abort. +branch.<name>.remote and branch.<name>.merge options will be used (see +linkgit:git-config[1] for details) and the `--fork-point` option is +assumed. If you are currently not on any branch or if the current +branch does not have a configured upstream, the rebase will abort. All changes made by commits in the current branch but that are not in <upstream> are saved to a temporary area. This is the same set -of commits that would be shown by `git log <upstream>..HEAD` (or -`git log HEAD`, if --root is specified). +of commits that would be shown by `git log <upstream>..HEAD`; or by +`git log 'fork_point'..HEAD`, if --fork-point is either specified or +assumed (see --fork-point description below); or by `git log HEAD`, if +--root is specified. The current branch is reset to <upstream>, or <newbase> if the --onto option was supplied. This has the exact same effect as
@@ -327,13 +329,18 @@ link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details) --fork-point:: --no-fork-point:: - Use 'git merge-base --fork-point' to find a better common ancestor - between `upstream` and `branch` when calculating which commits have - have been introduced by `branch` (see linkgit:git-merge-base[1]). + Use reflog to find a better common ancestor between <upstream> + and <branch> when calculating which commits have been + introduced by <branch>. + -If no non-option arguments are given on the command line, then the default is -`--fork-point @{u}` otherwise the `upstream` argument is interpreted literally -unless the `--fork-point` option is specified. +When --fork-point is active, 'fork_point' will be used instead of +<upstream> to calculate the set of commits to rebase, where +'fork_point' is the result of `git merge-base --fork-point <upstream> +<branch>` command (see linkgit:git-merge-base[1]). If 'fork_point' +ends up being empty, the <upstream> will be used instead. ++ +If either <upstream> or --root is given on the command line, then the +default is `--no-fork-point`, otherwise the default is `--fork-point`. --ignore-whitespace:: --whitespace=<option>::
Signature · 1 line
1.9.3
Quoted 7 lines · Sergey Organov
Vanilla "git rebase" defaults to --fork-point that in some cases makes behavior very different from "git rebase <upstream>", where --no-fork-point is assumed. This fact 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.
Quoted 7 lines
While we are at it, clarify the --fork-point description itself as well.
Signed-off-by Sergey Organov <[email protected]>---
As asked by Junio C Hamano <[email protected]>, the newly introduced 'fork_point' term has been described.
I suspect "will be used as a fallback" might be easier to understand what is going on instead of "will be used instead", but other than that, the new explanation of what fork-point is is a very welcome update, I think.
Quoted 9 lines
Documentation/git-rebase.txt +1
-0@@ -21,15 +21,17 @@ If <branch> is specified, 'git rebase' will perform an automatic it remains on the current branch. If <upstream> is not specified, the upstream configured in +branch.<name>.remote and branch.<name>.merge options will be used (see
Documentation/git-rebase.txt If <branch> is specified, 'git rebase' will perform an automatic · line 34
Quoted 10 lines
Documentation/git-rebase.txt +7
-0+linkgit:git-config[1] for details) and the `--fork-point` option is +assumed. If you are currently not on any branch or if the current +branch does not have a configured upstream, the rebase will abort. All changes made by commits in the current branch but that are not in <upstream> are saved to a temporary area. This is the same set +of commits that would be shown by `git log <upstream>..HEAD`; or by +`git log 'fork_point'..HEAD`, if --fork-point is either specified or +assumed (see --fork-point description below); or by `git log HEAD`, if +--root is specified.
It is easier to read with "is either specified or assumed" shortened to "is active", I think, because that is the word you use to explain how the commit is computed for --fork-point processing.
Quoted 11 lines
Documentation/git-rebase.txt +0
-0@@ -327,13 +329,18 @@link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details)
--fork-point::
--no-fork-point::Documentation/git-rebase.txt +4
-0+ Use reflog to find a better common ancestor between <upstream> + and <branch> when calculating which commits have been + introduced by <branch>. + +When --fork-point is active, 'fork_point' will be used instead of
Documentation/git-rebase.txt link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details) · line 346
Quoted 10 lines
Documentation/git-rebase.txt +7
-0+<upstream> to calculate the set of commits to rebase, where +'fork_point' is the result of `git merge-base --fork-point <upstream> +<branch>` command (see linkgit:git-merge-base[1]). If 'fork_point' +ends up being empty, the <upstream> will be used instead. ++ +If either <upstream> or --root is given on the command line, then the +default is `--no-fork-point`, otherwise the default is `--fork-point`. --ignore-whitespace:: --whitespace=<option>::
The patch failed to apply
Applying: Documentation/git-rebase.txt: discuss --fork-point assumption of vanilla "git rebase" in DESCRIPTION.
fatal: corrupt patch at line 38
but the fix-up is trivial, so no need to resend.
Thanks.
Quoted 2 lines · Junio C Hamano
Sergey Organov <[email protected]> writes:
[...]
Quoted 8 lines
Quoted 3 lines
As asked by Junio C Hamano <[email protected]>, the newly introduced '
fork_point' term has been described.I suspect "will be used as a fallback" might be easier to understand what is going on instead of "will be used instead", but other than that, the new explanation of what fork-point is is a very welcome update, I think.
Yeah, sure. Wasn't satisfied with the wording myself.
[...]
Quoted 1 line
The patch failed to apply
Sorry about it.
Quoted 2 lines
Applying:
Documentation/git-rebase.txt: discuss --fork-point assumption of vanilla "git rebase" in DESCRIPTION.
fatal: corrupt patch at line 38
I rather get:
$ git apply x.patch x.patch:38: trailing whitespace. introduced by <branch>. warning: 1 line adds whitespace errors.
I've used 'git format-patch' to prepare the patch. Shouldn't it warn about such things? Or what should I do to avoid such problems in the future?
Quoted 2 lines
but the fix-up is trivial, so no need to resend.
Thanks.
Signature · 1 line
Sergey.