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

Re: Bug in rebase --autosquash

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 19, 2022, 11:09 UTC
Message-ID
<8p78q4p9-9ro4-p5s4-r738-7sno17rqr414@tzk.qr>
In-Reply-To
<20220817094909.v2ev4rpsmxjnii4x@pengutronix.de>
Hi Uwe,
On Wed, 17 Aug 2022, Uwe Kleine-König wrote:
Show 35 quoted lines
> 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?

This demonstrates a somewhat obscure feature where the `fixup!` of a `fixup!` magically targets the original commit.

I understand that it is somewhat unintuitive that `fixup! fixup! abc` does not target `fixup! abc` but instead `abc`, but that's how the tool has been behaving forever.

Ciao, Dscho

Previous: Felipe ContrerasNext: Junio C Hamano
Message 3 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.