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

Re: git merge branch --no-commit does commit fast forward merges

From
Andrew Ardill <andrew.ardill@gmail.com>
Date
Apr 18, 2016, 07:44 UTC
Message-ID
<CAH5451mDYhavx_OLfXe6cC2WguCsFWEBBBBOCPyX3E6ZJw27+w@mail.gmail.com>
In-Reply-To
<87a8krpehl.fsf@gmail.com>
On 18 April 2016 at 17:23, Christoph Paulik <cpaulik@gmail.com> wrote:
Show 8 quoted lines
> My expectations from what should happen came mainly from the description of
> the --no-commit flag in the help:
>
> With --no-commit perform the merge but pretend the merge failed and do not
> autocommit, to give the user a chance to inspect and further tweak the merge
> result before committing.
> So in the case of a fast-forward the flag does not pretend that the merge
> failed.

Yes, I think the mis-alignment in expectations comes from a technicality in the description you quote. The fast forward is in some ways not really counted as a true merge, and no new commits are created.

Thus, the merge progresses up to the point where a merge resolution would have to take place, realises that there is no merge resolution to do (it's just a fast forward!) and so exits out. Unfortunately, a side effect of this is that the fast-forward has already happened and so you are left with something different from what was expected.

I do think that the --no-commit option should imply --no-ff (as this would make the behaviour consistent for end-users). I don't know if this is something that would break scripts etc, but if so you could make it implied only if we detect a terminal or something like is done in other places.

Regards,
Andrew Ardill
Previous: Christoph PaulikNext: Junio C Hamano
Message 6 of 21 in “git merge branch --no-commit does commit fast forward merges”
  1. Christoph PaulikApr 17, 2016
  2. Jacob KellerApr 17, 2016
  3. Johannes SchindelinApr 18, 2016
  4. Andrew ArdillApr 18, 2016
  5. Christoph PaulikApr 18, 2016
  6. Andrew ArdillApr 18, 2016
  7. Junio C HamanoApr 18, 2016
  8. Junio C HamanoApr 18, 2016
  9. 1/2 merge: do not contaminate option_commit with --squashJunio C Hamano, Apr 26, 2016
  10. Johannes SchindelinApr 27, 2016
  11. Junio C HamanoApr 27, 2016
  12. Johannes SchindelinApr 27, 2016
  13. 2/2 merge: warn --no-commit merge when no new commit is createdJunio C Hamano, Apr 26, 2016
  14. Stefan BellerApr 26, 2016
  15. Junio C HamanoApr 26, 2016
  16. Eric SunshineApr 27, 2016
  17. Johannes SixtApr 27, 2016
  18. Johannes SchindelinApr 27, 2016
  19. Junio C HamanoApr 27, 2016
  20. Johannes SchindelinApr 27, 2016
  21. Junio C HamanoApr 27, 2016

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.