git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brett Randall <javabrett@gmail.com>
To: git@vger.kernel.org
Subject: A couple of rebase --autosquash proposals
Date: Mon, 9 Dec 2013 13:23:00 +1100	[thread overview]
Message-ID: <CALeEUB4mTpd9tHJCC9Ffrfe6L=m0+gaDsXYSFGaO_tMcxCX_nA@mail.gmail.com> (raw)

Hi,

I am using Git 1.8.4.3 compiled by me on OEL6.  I'd like to be able to
use rebase --autosquash like this:

======================
# git log

commit b94f970cd869dfbf5254b19867fa7200df732d4f
Author: Me <me@me.com>
Date:   Mon Dec 9 17:02:32 2013 -0800

    fixup!
    This is a second fixup.

commit 64e516c8b26b7e0531a1e8b2fc8dfa21de259b85
Author: Me <me@me.com>
Date:   Sun Dec 8 17:02:32 2013 -0800

    fixup!
    This is a meaningful commit-log message, on a new line, that will
be discarded later during rebase --autosquash.

commit f21cd48d5eeac92130dc0617252c6ee6989c0252
Author: Me <me@me.com>
Date:   Tue Dec 3 21:47:52 2013 -0800

    This is the commit that will be fixed-up.

commit 259c0eb41ef16ac94868ee3c9253ba938ed24c9f
Author: Me <me@me.com>
Date:   Mon Dec 2 21:47:52 2013 -0800

    This commit is origin/master.
======================

then

# git rebase -i --autosquash 259c0eb41ef16ac94868ee3c9253ba938ed24c9f

The differences here are:

* fixup! or squash! on it's own would default to fixing-up the
previous commit (or result of previous step of rebase if that was a
squash/fixup).  Interestingly using HEAD~1 or HEAD^1 works, but it
only works for a single fixup/squash.  Is there another treeish that
would work?
* Allow real commit-log text, perhaps only on lines other than the
first line (the one containing the fixup).

The motivations are:

* I can default a fixup to apply to the previous commit (a common
wish) without explicitly stating it's treeish or commit-message.
* I can easily apply multiple fixups.
* I can retain a meaningful WIP commit-log prior to the rebase - I can
still see what each commit does, without needing to forgo the future
autosquash capability - just put the !fixup or !squash on the first
line on its own, and put the real changes on line 2 and onwards.  In
the case of squash! instead of fixup!, this means I could retain some
valuable text to be squashed into the original commit.

Thoughts on these two ideas?

Thanks
Brett

             reply	other threads:[~2013-12-09  2:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-09  2:23 Brett Randall [this message]
2013-12-09  6:51 ` A couple of rebase --autosquash proposals Johannes Sixt
2013-12-09  9:26   ` Chris Packham
2013-12-09  9:39     ` Philippe Vaucher
2013-12-09  9:52     ` Brett Randall
2013-12-09 20:20   ` Junio C Hamano
2013-12-09 23:20     ` Brett Randall

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='CALeEUB4mTpd9tHJCC9Ffrfe6L=m0+gaDsXYSFGaO_tMcxCX_nA@mail.gmail.com' \
    --to=javabrett@gmail.com \
    --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).