git rebase

I just moved some patches to the Linux kernel from a 2.6.15 base to a 2.6.16.18 base.

This is how I did it:

  • I started by going to my copy of the Linus Torvalds tree, and updating it.
% cd /mara1/git/torvalds % cg-branch-ls origin http://www.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git % cg-update

to get the latest code down, just in case.

  • I then cloned the tree.
% cd /mara1/git % cg-clone torvalds stable2.6.16.y

Cloning it like this lets it use hard links!

  • I then added the 2.6.16 branches:
% cd stable2.6.16.y % cg-branch-add stable2.6.16.y http://www.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.16.y.git % cg-update stable2.6.16.y
  • I then added the stable 2.6.16 tree to my working tree. I prefer to have seperate trees like this so that I can poke around. I could added the stable branch to my torvalds tree, btw.
% cd /mara1/git/klips-ocf % cg-branch-add stable /mara1/git/stable2.6.16.y % cg-fetch stable
  • Then I ran git rebase.
% cg-tag ocf_v2.6.15 % git rebase stable ocf % cg-branch-chg origin git+ssh://git.openswan.org/public/scm/klips.git#ocf_v2.6.16

I made sure to leave a tag, because “git rebase” changes the branch, and you might not be able to get it back.