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

Antw: Re: [PATCH v2] merge-options.txt: correct wording of --no-commit option

From
UWUlrich Windl <ulrich.windl@rz.uni-regensburg.de>
Date
Feb 20, 2019, 07:29 UTC
Message-ID
<5C6D01C6020000A10002FC4C@gwsmtp1.uni-regensburg.de>
In-Reply-To
<AC7679FC02000011B9FD70CF@gwsmtp1.uni-regensburg.de>
>>> Junio C Hamano <gitster@pobox.com> schrieb am 19.02.2019 um 20:32 in

Nachricht <xmqqk1hv1sms.fsf@gitster-ct.c.googlers.com>:

Show 23 quoted lines
> Elijah Newren <newren@gmail.com> writes:
> 
>> +With ‑‑no‑commit perform the merge and stop just before creating
>> +a merge commit, to give the user a chance to inspect and further
>> +tweak the merge result before committing.
>> ++
>> +Note that fast‑forward updates do not need to create a merge
>> +commit and therefore there is no way to stop those merges with
>> +‑‑no‑commit.  Thus, if you want to ensure your branch is not
>> +changed or updated by the merge command, use ‑‑no‑ff with
>> +‑‑no‑commit.
> 
> While the above is an improvement (so I'll queue it on 'pu' not to
> lose sight of it), I find the use of "do not need to" above somewhat
> misleading.  It solicits a reaction "ok, we know it does not need
> to, but it could prepare to create one to allow us to further muck
> with it, no?".
> 
> IOW, a fast‑forward by definition does not create a merge by itself,
> so there is nowhere to stop during a creation of a merge.  So at
> least:
> 
> 	s/do not need to/do not/
Agree.
Show 30 quoted lines
> 
> It also may be a good idea to consider detecting this case and be a
> bit more helpful, perhaps with end‑user experience looking like...
> 
>   $ git checkout master^0
>   $ git merge ‑‑no‑commit next
>   Updating 0d0ac3826a..ee538a81fe
>   Fast‑forward
>     ...diffstat follows here...
>   hint: merge completed without creating a commit.
>   hint: if you wanted to prepare for a manually tweaked merge,
>   hint: do "git reset ‑‑keep ORIG_HEAD" followed by
>   hint: "git merge ‑‑no‑ff ‑‑no‑commit next".
> 
> or even
> 
>   $ git checkout master^0
>   $ git merge ‑‑no‑commit next
>   warning: defaulting to ‑‑no‑ff, given a ‑‑no‑commit request
>   Automatic merge went well; stopped before committing as requested
>   hint: if you'd rather have a fast‑forward without creating a commit,
>   hint: do "git reset ‑‑keep next" now.
> 
> I do not have a strong preference among three (the third option
> being not doing anything), but if pressed, I'd say that the last one
> might be the most user‑friendly, even though it feels a bit too
> magical and trying to be smarter than its own good.
> 
> In any case, the hint for the "recovery" procedure needs to be
> carefully written.

Actually I think if the user specified "--no-commit" and the merge turns out to be fast-forward, the user could be asked whether to continue or not (instead of undoinf afterwards); maybe when entering a response is not possible (batch processing) the merge should be aborted due to "--no-commit" not being possible (well actually there would never be a commit, even without that option). The problem is that without prior inspection of the tree you cannot know whether the merge will be fast-forward or not: fast-forward being an optimization (taht is enabled by default) makes life more complicated here.

Regards, Ulrich Windl

Previous: Elijah Newren
Message 11 of 11 in “Q: What happened to "--no-commit" merges?”
  1. Ulrich WindlJan 22, 2019
  2. Elijah NewrenJan 22, 2019
  3. Antw: Re: Q: What happened to "--no-commit" merges?Ulrich Windl, Jan 23, 2019
  4. Elijah Newren, Feb 18, 2019
  5. Antw: Antw:Ulrich Windl, Feb 19, 2019
  6. merge-options.txt: correct wording of --no-commit optionElijah Newren, Feb 19, 2019
  7. Junio C HamanoFeb 19, 2019
  8. Elijah NewrenFeb 19, 2019
  9. Junio C HamanoFeb 19, 2019
  10. merge-options.txt: correct wording of --no-commit optionElijah Newren, Feb 21, 2019
  11. Antw: Re: [PATCH v2] merge-options.txt: correct wording of --no-commit optionUlrich Windl, Feb 20, 2019

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.