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

`git rebase -i --rebase-merges` formatting

From
JUJan Christoph Uhde <jan@uhdejc.com>
Date
Mar 11, 2022, 14:58 UTC
Message-ID
<9c494301-3c52-c953-95ab-48675634ada7@UhdeJc.com>
Hello,
for the following commits:
``` git log
*   4fd94fd  (HEAD -> master) 6 hours ago Jan Christoph Uhde Merge branch 'b_two'
|\
| * cc75466  6 hours ago Jan Christoph Uhde b_two
|/
*   9ad8a2b  6 hours ago Jan Christoph Uhde Merge branch 'b_one'
|\
| * b23658f  (b_one) 6 hours ago Jan Christoph Uhde one
|/
* a9d65bc  6 hours ago Jan Christoph Uhde initial commit
```
I get a this merge script when rebasing onto the initial commit.
``` actual merge script
   1 label onto
   2
   3 # Branch b-one
   4 reset onto
   5 pick b23658f one
   6 label b-one
   7
   8 # Branch b-two
   9 reset onto
  10 merge -C 9ad8a2b b-one # Merge branch 'b_one'
  11 label branch-point
  12 pick cc75466 b_two
  13 label b-two
  14
  15 reset branch-point # Merge branch 'b_one'
  16 merge -C 4fd94fd b-two # Merge branch 'b_two'
  17
  18 # Rebase a9d65bc..4fd94fd onto a9d65bc (11 commands)
  19 #
```
I think it should be more similar to this:
``` suggested merge script
   1 label onto
   2 reset onto #Could imo go but probably avoids special cases
   3
   4 # Branch b-one
   5 pick b23658f one
   6 label b-one
   7 reset onto
   8 merge -C 9ad8a2b b-one # Merge branch 'b_one'
   9 label branch-point
  10
  11 # Branch b-two
  12 pick cc75466 b_two
  13 label b-two
  14 reset branch-point # Merge branch 'b_one'
  15 merge -C 4fd94fd b-two # Merge branch 'b_two'
  16 # add `label branch-point-1` here to avoid special cases?!
  17
  18 # Rebase a9d65bc..4fd94fd onto a9d65bc (11 commands)
  19 #
```

Looking at the sequencer.c it might not be worth the invested time to change the format. If it can not be resolved easily I think removing the empty lines and the branch-comments would suffice to reduce the confusion. I think they have been introduced to help people but here they are a hindrance.

Another unrelated suggestion is to start with `branch-point-0` instead of `onto` and keep counting up. This would make the edit-distances smaller when you fiddle with the first commits.

Regards
Jan
Next: Johannes Schindelin
Message 1 of 2 in “`git rebase -i --rebase-merges` formatting”
  1. Jan Christoph UhdeMar 11, 2022
  2. Johannes SchindelinMar 24, 2022

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.