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

Re: Feature Request: `git commit --amend-to`

From
Glen Choo <chooglen@google.com>
Date
Sep 29, 2021, 16:55 UTC
Message-ID
<kl6lwnmzpbhq.fsf@chooglen-macbookpro.roam.corp.google.com>
In-Reply-To
<87y27gv5bk.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 7 quoted lines
>> [...] I think the problem
>> has more to do with how Git manages merges and conflicts and less to do
>> with having shortcuts in the CLI.
>
> I think that users who'd like an --amend-to would probably be happy with
> or might want to try out something like "hg absorb", which is something
> I think we should have stolen in git already, but it's never too late.

Agree. I think some "hg absorb" features get at the heart of what I meant, which is that users would benefit from making this merge conflict resolution a lot simpler.

> I.e. it's a "git commit --squash" on steroids, which tries to find what
> commit to amend things into.

But this is an even bigger step up from what I was suggesting. I blame my own lack of imagination for not even considering this possibility.

To me, what really sells the feature is the "history of lines" approach cited in https://gregoryszorc.com/blog/2018/11/05/absorbing-commit-changes-in-mercurial-4.8/:

  The automatic rewriting logic of hg absorb is implemented by following
  the history of lines. This is fundamentally different from the approach
  taken by hg histedit or git rebase, which tend to rely on merge
  strategies based on the 3-way merge to derive a new version of a file
  given multiple input versions.

Traditional 3-way merge is extremely frustrating when you find yourself touching the same lines over and over in a rebase, and I think "history of lines" maps quite cleanly to how humans think of lines. However I'm not sure if Git has any machinery for doing this.

Previous: Ævar Arnfjörð BjarmasonNext: Fabian Stelzer
Message 5 of 7 in “Feature Request: `git commit --amend-to`”
  1. Aidan GallagherSep 24, 2021
  2. Carlo ArenasSep 24, 2021
  3. Glen ChooSep 28, 2021
  4. Ævar Arnfjörð BjarmasonSep 28, 2021
  5. Glen ChooSep 29, 2021
  6. Fabian StelzerSep 30, 2021
  7. Phillip WoodSep 30, 2021

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.