git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Documentation/git-rebase.txt: discuss --fork-point assumption of vanilla "git rebase" in DESCRIPTION.

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 22, 2014, 19:35 UTC
Message-ID
<xmqqzjdrjvnd.fsf@gitster.dls.corp.google.com>
In-Reply-To
<87r3z72wiu.fsf@osv.gnss.ru>
Sergey Organov <sorganov@gmail.com> writes:
Show 30 quoted lines
> 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 <sorganov@gmail.com>
> ---
>  Documentation/git-rebase.txt | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
> index 4138554..73e1e1c 100644
> --- a/Documentation/git-rebase.txt
> +++ b/Documentation/git-rebase.txt
> @@ -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.

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.

Show 7 quoted lines
>  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.

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)"?

Show 9 quoted lines
> @@ -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.
Previous: Sergey OrganovNext: Sergey Organov
Message 5 of 8 in “Documentation/git-rebase.txt: discuss --fork-point assumption of vanilla "git rebase" in DESCRIPTION.”
  1. Documentation/git-rebase.txt: discuss --fork-point assumption of vanilla "git rebase" in DESCRIPTION.Sergey Organov, Sep 18, 2014
  2. Documentation/git-rebase.txt: discuss --fork-point assumption of vanilla "git rebase" in DESCRIPTION.Sergey Organov, Sep 18, 2014
  3. Junio C HamanoSep 29, 2014
  4. Sergey OrganovSep 29, 2014
  5. Junio C HamanoSep 22, 2014
  6. Sergey OrganovSep 23, 2014
  7. Junio C HamanoSep 26, 2014
  8. Sergey OrganovSep 29, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.