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

Re: git-rebase eats empty commits

From
Michael J Gruber <michaeljgruber+gmane@fastmail.fm>
Date
Jul 16, 2008, 09:24 UTC
Message-ID
<487DBE56.9020201@fastmail.fm>
In-Reply-To
<20080715201902.GC6244@leksak.fem-net>
Stephan Beyer venit, vidit, dixit 15.07.2008 22:19:
> Hi,
...
Show 9 quoted lines
> any version of git. Or I am missing a point.
> 
> 	$ git cherry-pick empty		# empty is an empty commit tagged as "empty"
> 	Already uptodate!
> 	Finished one cherry-pick.
> 	# Not currently on any branch.
> 	# Untracked files:
> 	[...]
> 	nothing added to commit but untracked files present (use "git add" to track)

How would an empty commit produce untracked files? You seem to be testing something different.

I reattach the test case from my original post, as well as the log of runs with git 1.5.6.3: once with rebase and once with rebase -i.

Uuuh, doh: I interpreted

Finished one cherry-pick. # Not currently on any branch. nothing to commit (working directory clean) Could not apply e1f497c... empty 1 8d0c67a675bc65d375e8a9d019500bb2a16fb1e9 rewritten 1

as the end of the (interactive) rebase operation! Nothing indicated it was interrupted: no message and no git status output. It all looked like a failed rebase.

Now, thanks to your persistence, I tried going ahead with commit --amend and rebase --continue, and all went fine (stopped again for empty 2, giving no clue; amend & cont).

So, you're right: cherry-pick stops at empty commits, so that rebase -i is the way to go. rebase (non-i) uses format-patch resp. merge (-m), which eat empty commits.

I recall some discussion about informative rb-i messages, may upcoming git would have saved me and will save others from this misinterpretation.

Thanks! Michael

Initialized empty Git repository in /tmp/mjg/t/empty/.git/
Created initial commit 6b9e2af: 1
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 a
Created commit 8387962: empty 1
Created commit 6c4c3fe: 2
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 b
Created commit 3521900: empty 2
3521900fb7b032aa9e1f5a50a82f71785aa5c208 empty 2
6c4c3fe8b7619e1107256d0b47d0f419c05ceb69 2
8387962b740bb47662dd866eb57b4fe5ad21b355 empty 1
6b9e2afad8bed27378f0c9d23e77631be8447d37 1
Switched to a new branch "temp"
Created commit 1cced89: rewritten 1
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 a
First, rewinding head to replay your work on top of it...
Applying 2
a4116113335fc6be47fb9f8481547ea0923ac09d 2
1cced892a90024f4230a9f7aec1989ffe0b6c16f rewritten 1
Initialized empty Git repository in /tmp/mjg/t/empty/.git/
Created initial commit 2796c9d: 1
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 a
Created commit e1f497c: empty 1
Created commit b3867ae: 2
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 b
Created commit 2edad43: empty 2
2edad436286f39e407b83bbb448b3aa62b91aeb9 empty 2
b3867ae2a345ab30bfd68a1c7e0e19999a1eb9eb 2
e1f497c4ee7a040162faa7dcc2b6d8e41d5fd920 empty 1
2796c9d9f8fced86134e5b36462916c938c6f819 1
Switched to a new branch "temp"
Created commit 8d0c67a: rewritten 1
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 a
Rebasing (1/3)
Already uptodate!
Finished one cherry-pick.
# Not currently on any branch.
nothing to commit (working directory clean)
Could not apply e1f497c... empty 1
8d0c67a675bc65d375e8a9d019500bb2a16fb1e9 rewritten 1
Previous: Stephan Beyer
Message 5 of 5 in “git-rebase eats empty commits”
  1. Michael J GruberJul 8, 2008
  2. Stephan BeyerJul 12, 2008
  3. Michael J GruberJul 14, 2008
  4. Stephan BeyerJul 15, 2008
  5. Michael J GruberJul 16, 2008

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.