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

Bug in rebase --autosquash

From
Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date
Aug 17, 2022, 09:49 UTC
Message-ID
<20220817094909.v2ev4rpsmxjnii4x@pengutronix.de>
Hello,
after:
	uwe@taurus:~/tmp/git$ git version
	git version 2.37.2
	uwe@taurus:~/tmp/git$ git init
	Initialized empty Git repository in /home/uwe/tmp/git/.git/
	uwe@taurus:~/tmp/git$ echo contnt > file
	uwe@taurus:~/tmp/git$ git add file
	uwe@taurus:~/tmp/git$ git commit -m 'file with content'
	...
	uwe@taurus:~/tmp/git$ echo 'content' > file
	uwe@taurus:~/tmp/git$ git commit --fixup=@ file
	[main ef8f0bd27a56] fixup! file with content
	uwe@taurus:~/tmp/git$ echo 'more content' >> file
	uwe@taurus:~/tmp/git$ git commit --fixup=@ file
	[main b40a214bf5fb] fixup! fixup! file with content
	 1 file changed, 1 insertion(+)
running
	git rebase -i --autosquash @~2
my editor presents me with:
	pick ef8f0bd27a56 fixup! file with content
	pick b40a214bf5fb fixup! fixup! file with content
However I would have expected
	pick ef8f0bd27a56 fixup! file with content
	fixup b40a214bf5fb fixup! fixup! file with content
instead.
Is this a feature I don't understand?
When the original commit is in the range (i.e. with
	git rebase -i --autosquash --root
) it does the right thing, i.e. my editor then has:
	pick 0c1d21698c38 file with content
	fixup ef8f0bd27a56 fixup! file with content
	fixup b40a214bf5fb fixup! fixup! file with content
. Unrelated to that, but annoying is, that
	git rebase --autosquash --root

doesn't do the right thing. It doesn't change the history at all, while I expected it to only contain a single commit then.

Best regards Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
Next: Felipe Contreras
Message 1 of 4 in “Bug in rebase --autosquash”
  1. Uwe Kleine-KönigAug 17, 2022
  2. Felipe ContrerasAug 17, 2022
  3. Johannes SchindelinAug 19, 2022
  4. Junio C HamanoAug 19, 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.