From: Tim Chase <git@tim.thechases.com>
To: David Aguilar <davvid@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Splitting a commit with rebase -i and keeping a commit message
Date: Tue, 16 Apr 2013 22:04:07 -0500 [thread overview]
Message-ID: <20130416220407.105b354e@bigbox.christie.dr> (raw)
In-Reply-To: <CAJDDKr64KpF-DP5Axj+vhxRQ1rrig=pm25T3Angp8GaKK_CHMA@mail.gmail.com>
On 2013-04-16 19:29, David Aguilar wrote:
> On Tue, Apr 16, 2013 at 6:38 PM, Tim Chase <git@tim.thechases.com>
> wrote:
> > git commit -am "Long-bodied commit comment about b.txt changes"
> > # whoops, just wanted B
>
> Save the commit's ID here so that we can reuse its message later:
>
> orig_commit=$(git rev-parse HEAD)
>
> > git rebase -i HEAD^^
> > # change the "Added b.txt..." commit to "edit"
> > git reset HEAD^ # pull the changes out of the pending commit
> > git add a.txt
> > git commit -m "Tweaked a.txt"
> > git add b.txt
> > git commit ${MAGIC_HERE}
>
> ...reuse the commit message by passing the "-c" option to "git
> commit":
>
> git commit --reset-author -c $orig_commit
Wild guess or not, using -c worked great. With the appropriate
section of the docs now in hand, I discovered that it could even be
simplified to just
git commit -c ORIG_HEAD [...]
as rebase stashes that information away for me already as "ORIG_HEAD".
Thanks!
-tkc
next prev parent reply other threads:[~2013-04-17 3:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-17 1:38 Splitting a commit with rebase -i and keeping a commit message Tim Chase
2013-04-17 2:29 ` David Aguilar
2013-04-17 3:04 ` Tim Chase [this message]
2013-04-17 5:55 ` Johannes Sixt
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=20130416220407.105b354e@bigbox.christie.dr \
--to=git@tim.thechases.com \
--cc=davvid@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).