Mar 30, 2008

Cleaning Up Revision Histories

A post in the the bazaar email group described a better approach (than I had been using) to manage merges from personal working branches. For example; If I wanted to commit a change to the project 'Foo', according to the post, I'd do something like this...

$> bzr init-repo foo-branches
$> cd foo-branches
$> bzr branch http://example.com/foo-trunk trunk
$> bzr branch trunk workbranch
$> cd mybranch
$> # hack, commit, hack commit, repeat as necessary
$> cd ../trunk
$> bzr pull
$> bzr merge ../workbranch
$> bzr commit
$> bzr push
What I've done above is to first create a shared repository. I do this because I'm going to be working with multiple branches of the same project. Then I branch Foo's trunk into my new shared repository. Next I branch the trunk (that's in the repository) to my personal working branch, make all the changes and as many commits as I want. When I'm done I go back to the trunk. Pull it to make sure it's up to date. Then merge in my changes. Once I've done that I commit them and push them up to the server.

If you're worried about disk space you can remove the working trees for any branch you're not currently working in.

No comments: