Stephan Beyer venit, vidit, dixit 15.07.2008 22:19:
Hi,
...
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 1as 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
Attachment:
empty.sh
Description: application/shellscript
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