Re: Splitting a commit with rebase -i and keeping a commit message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2013-04-16 19:29, David Aguilar wrote:
> On Tue, Apr 16, 2013 at 6:38 PM, Tim Chase <git@xxxxxxxxxxxxxxxxx>
> 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






--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]