On keeping history clean
So you've done some work on the parisc git tree, you've been committing stuff as you go, and now it's time to merge back. Unfortunately, other people have also been working on the tree, and so your history is full of merges that you'd like to get rid of. Here's how to do it.
I have a pretty simple situation here; I did a couple of commits, then I pulled the recent 2.6.18-rc6 merge.
So what would I push?
$ git-log origin..master commit 59c4c2b0510ff0b8acd904c0cbc52a7cba788baf Merge: 302eeed... df0e7cd... Author: Matthew Wilcox <[email protected]> Date: Tue Sep 12 05:21:19 2006 -0600
Merge branch 'master' of /var/git/linux-2.6
commit 302eeedbcb19477ebaee30fe934f4b82cb44fbba
Author: Matthew Wilcox <[email protected]> Date: Tue Sep 12 05:19:15 2006 -0600
Remove some obsolete comments and I checked that Reo is similar to Ike.
commit 7f51f71822a4019136d3297ba5b50ff9fca8e9f3
Author: Matthew Wilcox <[email protected]> Date: Tue Sep 12 05:17:59 2006 -0600
Hardware found in the rp8400
The merge commit has to be eliminated. So create a new branch:
$ git-branch merge origin $ git-checkout merge $ git-cherry-pick -e 7f51f71822a4019136d3297ba5b50ff9fca8e9f3 $ git-cherry-pick -e 302eeedbcb19477ebaee30fe934f4b82cb44fbba
I use the -e so I can get rid of the message appended by cherry-pick.
Now let's pretend the original branch never happened.
$ git-branch -D master $ git-checkout -b master $ git-branch -d merge
And finally, push to palinux.
$ git-push
Voila, no more merge commits. I'm sure someone with more git expertise can tell me a better way of doing this ... but it works.
_______________________________________________
parisc-linux mailing list [email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
[parisc-linux] Zen and the Art of Merge Maintenance
Ok, this is how I've been doing merges on palinux.
(Using palinux only to minimize the amount of uploading I have to do
when I push the tree)
## first, update the `linus' branch on palinux
$ git fetch \ git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git \ master:linus
## then push the branch back, and any new tags
$ git push origin linus:linus $ git push --tags origin
## make sure the tree is clean
$ git checkout -f
## then do the merge from a tag
$ git pull origin refs/tags/v2.6.18-rc6:master
## look at, and fix up conflicts
$ vi Makefile
## edit the merge message to remove the conflicts section
$ git commit -a
## tag the merge
$ git tag -a v2.6.18-rc6-pa0
## push
$ git push origin $ git push --tags origin
## and we're done
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux