Skip navigation

Monthly Archives: February 2011

Prompted by Kohei’s nice howto for extracting part of a git repository’s history into a new repo, I attempted the same for our tinbuild script – but it seemed not really optimal for my case.

Instead, I mis-used git rebase --interactive, to transplant the relevant commits into a new and unrelated branch.

Created an entirely new repo, added some boilerplate, like a readme:

mkdir buildbot; cd buildbot
git init; cat ">useful info<" > README; git add README; git commit -m "added readme"

Add the (unrelated) libreoffice/bootstrap repo, so we can grab commits from there:

git remote add libo git://anongit.freedesktop.org/libreoffice/bootstrap
git fetch libo; git checkout -b libo libo/master

Find all the commits to our bin/tinbuild script, that we want to transplant:

git log --pretty="format:pick %h" --reverse  bin/tinbuild

Which already yields a suitable format for the interactive rebase, so here we go:

git checkout master
git rebase -i --onto HEAD master libo

The latter one takes all commits from the libo branch, that are not in master, and transplants them on top of HEAD – so you have to delete all suggested picks of course, and replace it with the list generated by the git log from above.

Resulting repo is here, only pushed the resulting master branch of course.