git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-rebase eats empty commits
@ 2008-07-08 13:59 Michael J Gruber
  2008-07-12 22:12 ` Stephan Beyer
  0 siblings, 1 reply; 5+ messages in thread
From: Michael J Gruber @ 2008-07-08 13:59 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 880 bytes --]

"git commit" allows empty commits with the "--allow-empty" option, i.e. 
commits which introduce no change at all. This is sometimes useful for 
keeping a log of untracked work related to tracked content.

"git rebase" removes empty commits, for the good reason that rebasing 
may make certain commits obsolete; but I don't want that in the case 
mentioned above. Is there any way to specify "--preserve-empty" or similar?

The attached script and log show the effect: a series A B C D of commits 
is rebased onto A'; the result is A' C', with the empty commits B and D 
disappearing.

grafts and filter-branch helped me solve a particular case of that 
effect, but I think it will show up again, so an option for rebase would 
be useful.

Michael

P.S.: I also noticed that 'Switched to a new branch "temp"' is written 
to stderr, everything else to stdout. Is that as intended?

[-- Attachment #2: empty.log --]
[-- Type: text/x-log, Size: 816 bytes --]

Initialized empty Git repository in /tmp/mjg/t/empty/.git/
Created initial commit b3104c1: 1
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 a
Created commit 7265e0c: empty 1
Created commit 9b67221: 2
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 b
Created commit 0778af2: empty 2
0778af2a5003df310cb9dc3c4fff1f8992619610 empty 2
9b67221a363103ebc78fc052c382637a87ef04e6 2
7265e0c1a35c95bd6fcf739a9f815b300ba9d9cc empty 1
b3104c148e1dd6ce8fd23cddb71734e45e7d9132 1
Switched to a new branch "temp"
Created commit d9ad4bc: 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
d81ec616edd3ed600a60dbd63d4d0f4a7263387f 2
d9ad4bcd2fb5e78f2f430733f2dc36453a653221 rewritten 1

[-- Attachment #3: empty.sh --]
[-- Type: application/x-shellscript, Size: 400 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-07-16  9:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-08 13:59 git-rebase eats empty commits Michael J Gruber
2008-07-12 22:12 ` Stephan Beyer
2008-07-14 15:01   ` Michael J Gruber
2008-07-15 20:19     ` Stephan Beyer
2008-07-16  9:24       ` Michael J Gruber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).