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

Re: [SCRIPT/RFC 0/3] git-commit --onto-parent (three-way merge, no working tree file changes)

From
Johannes Sixt <j6t@kdbg.org>
Date
Dec 1, 2017, 17:23 UTC
Message-ID
<33e97533-716b-e1cc-6aa0-bf8941225319@kdbg.org>
In-Reply-To
<741dfedc-07f8-24fb-ebe2-940f8b2639d4@gmail.com>
Am 30.11.2017 um 00:10 schrieb Igor Djordjevic:
Show 19 quoted lines
> On 29/11/2017 20:11, Johannes Sixt wrote:
>> With git-post, I make a fixup commit commit on the integration
>> branch, then `git post B && git merge B`:
>>
>>   ...A    ...C                  <- topics A, C
>>       \       \
>>     ---o---o---o---o---f---F    <- integration
>>           /       /       /
>>       ...B    ...D       /      <- topic D
>>           \             /
>>            f'----------'        <- topic B
>>
>> The merge F does not introduce any changes on the integration branch,
>> so I do not need it, but it helps keep topic B off radar when I ask
>> `git branch --no-merged` later.
> 
> But you`re not committing (posting) on your HEAD`s (direct) parent in
> the first place (topic B), so `commit --onto-parent` isn`t right tool
> for the job... yet :)
Ohh..kay.
Show 12 quoted lines
> To work with `--onto-parent` and be able to commit on top of any of
> the topic branches, you would need a situation like this instead:
> 
>   (1)  ...C      <- topic C
>           |
>      ...A |      <- topic A
>          \|
>        ...o I    <- integration
>          /|
>      ...B |      <- topic B
>           |
>        ...D      <- topic D

This is a very, VERY exotic workflow, I would say. How would you construct commit I when three or more topics have conflicts? merge-octopus does not support this use-case.

Show 44 quoted lines
> With `commit --onto-parent` you would skip `git post B && git merge
> B` steps, where "fixup commit" would be done with `--onto-parent B`,
> So you end up in situation like this:
> 
>   (2)      ...C      <- topic C
>               |
>          ...A |      <- topic A
>              \|
>            ...o I'   <- integration
>              /|
>      ...B---f |      <- topic B
>               |
>            ...D      <- topic D
> 
> State of index and working tree files in your F and my I' commit is
> exactly the same (I' = I + f), where in my case (2) history looks
> like "f" was part of topic B from the start, before integration
> merge happened.
> 
> BUT, all this said, I understand that your starting position, where
> not all topic branches are merged at the same time (possibly to keep
> conflict resolution sane), is probably more often to be encountered
> in real-life work... and as existing `--onto-parent` machinery should
> be able to support it already, I`m looking forward to make it happen :)
> 
> Once there, starting from your initial position:
> 
>>     ...A    ...C            <- topics A, C
>>         \       \ E
>>       ---o---o---o---o I    <- integration <- HEAD
>>             /       /
>>         ...B    ...D        <- topics B, D
> 
> ... and doing something like `git commit --onto B --merge` would yield:
>   
>   (3) ...A    ...C            <- topics A, C
>           \       \ E
>         ---o---o---o---o I'   <- integration
>               /       /|
>           ...B    ...D |      <- topic D
>               \        |
>                f-------'      <- topic B
> 
> ... where (I' = I + f) is still true.

I am not used to this picture. I would not think that it is totally unacceptable, but it still has a hmm-factor.

Show 13 quoted lines
> If that`s preferred in some
> cases, it could even look like this instead:
> 
>   (4) ...A    ...C             <- topics A, C
>           \       \ E  I
>         ---o---o---o---o---F   <- integration
>               /       /   /
>           ...B    ...D   /     <- topic D
>               \         /
>                f-------'       <- topic B
> 
> ... where F(4) = I'(3), so similar situation, just that we don`t
> discard I but post F on top of it.
This is very acceptable.

Nevertheless, IMO, it is not the task of git-commit to re-compute a merge commit. It would be OK that it commits changes on top of a branch that is not checked out. Perhaps it would even be OK to remove the change from the current workspace (index and worktree), because it will return in the form of a merge later, but producing that merge is certainly not the task of git-commit.

-- Hannes
Previous: Igor DjordjevicNext: Igor Djordjevic
Message 9 of 26 in “[SCRIPT/RFC 0/3] git-commit --onto-parent (three-way merge, no working tree file changes)”
  1. Igor DjordjevicNov 26, 2017
  2. 1/3 setup.shIgor Djordjevic, Nov 26, 2017
  3. 3/3 git-commit--onto-parent.shIgor Djordjevic, Nov 26, 2017
  4. 2/3 git-merge-one-file--cachedIgor Djordjevic, Nov 26, 2017
  5. Johannes SixtNov 27, 2017
  6. Igor DjordjevicNov 28, 2017
  7. Johannes SixtNov 29, 2017
  8. Igor DjordjevicNov 29, 2017
  9. Johannes SixtDec 1, 2017
  10. Igor DjordjevicDec 4, 2017
  11. Johannes SixtDec 6, 2017
  12. Junio C HamanoDec 6, 2017
  13. Igor DjordjevicDec 8, 2017
  14. Junio C HamanoDec 8, 2017
  15. Igor DjordjevicDec 8, 2017
  16. Alexei LozovskyDec 9, 2017
  17. Igor DjordjevicDec 9, 2017
  18. Phillip WoodDec 9, 2017
  19. Igor DjordjevicDec 10, 2017
  20. Phillip WoodDec 10, 2017
  21. Igor DjordjevicDec 10, 2017
  22. Alexei LozovskyDec 11, 2017
  23. Alexei LozovskyDec 11, 2017
  24. Phillip WoodDec 9, 2017
  25. Chris NerwertNov 30, 2017
  26. Igor DjordjevicDec 3, 2017

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.