Re: Merging commits together into a super-commit
- From
Johannes Sixt <j.sixt@eudaptics.com>
- Date
- May 10, 2007, 11:40 UTC
- Message-ID
- <4643049C.3D5F30D8@eudaptics.com>
- In-Reply-To
- <1178794261.5806.98.camel@murta.transitives.com>
Alex Bennee wrote:
Show 21 quoted lines
> I really love the fact I can micro-commit changes when I'm developing. > However at some point the combination of changes I have made can be > considered a single body of work. This is especially true when you start > doing things like re-basing on code that has moved around a lot. You > don't want to be correcting a whole bunch of merge failures for every > commit in your current tree. > > So far the only was I can see to do this is a: > > git-diff master..HEAD > my.patch > > And then re-applying your patch in stages, manually doing the commits. > > Am I missing something? > > I'm thinking something like git-cherrypick taking multiple commits and > create a new super commit on a new tree. i.e.: > > git-cherrypick -m "Valgrind fixes" 12345.. 12678.. 565757.. > > Merging the existing commit comments would be nice too.
Here we go:
- cherry-pick them before commit
$ git cherry-pick -n x $ git cherry-pick -n y $ git cherry-pick -n z $ git commit -m "$(for c in x y z; do git show --stat $c; done)" -e
- merge in a single commit
$ git merge --squash foo
You didn't really think that git couldn't do that, did you? ;)
-- Hannes