git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Splitting a commit with rebase -i and keeping a commit message
@ 2013-04-17  1:38 Tim Chase
  2013-04-17  2:29 ` David Aguilar
  2013-04-17  5:55 ` Johannes Sixt
  0 siblings, 2 replies; 4+ messages in thread
From: Tim Chase @ 2013-04-17  1:38 UTC (permalink / raw)
  To: git

I asked this on IRC and played with some of their ideas, but struck
out with anything satisfying.  I walked through [1] with the
following setup:

  git init foo
  cd foo
  touch a.txt b.txt
  git add a.txt b.txt
  git commit -m "Initial checkin"
  echo "Modify A" >> a.txt
  git commit -am "Modified A"
  echo "Modify B" >> b.txt
  git commit -am "Modified B"
  echo "Modify A2" >> a.txt
  echo "Modify B2" >> b.txt
  git commit -am "Modified B"
  git commit -am "Long-bodied commit comment about b.txt changes"
  # whoops, just wanted B
  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}
  git rebase --continue

I haven't been able to figure out a good way to keep the "long-bodied
commit comment" for the final commit where the ${MAGIC_HERE} is.  Is
there a right/easy way to go about pulling in the commit-message from
the commit the rebase is transplanting?

-tkc

[1]
http://git-scm.com/book/en/Git-Tools-Rewriting-History#Splitting-a-Commit

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

end of thread, other threads:[~2013-04-17  5:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-04-17  5:55 ` Johannes Sixt

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).