git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <michaeljgruber+gmane@fastmail.fm>
To: git@vger.kernel.org
Subject: git-rebase eats empty commits
Date: Tue, 08 Jul 2008 15:59:16 +0200	[thread overview]
Message-ID: <g4vrrm$g35$1@ger.gmane.org> (raw)

[-- 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 --]

             reply	other threads:[~2008-07-08 14:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-08 13:59 Michael J Gruber [this message]
2008-07-12 22:12 ` git-rebase eats empty commits 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='g4vrrm$g35$1@ger.gmane.org' \
    --to=michaeljgruber+gmane@fastmail.fm \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).