Skip navigation

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: