Tuesday, January 27, 2009

Bazaar Merge - How to

Updating your branch from the main branch

While you commit changes to your branch, it's likely that other people will also continue to commit code to the parent branch.

To make sure your branch stays up to date, you should merge changes from the parent into your personal branch:

$ bzr merge Merging from saved parent location: http://bazaar.launchpad.net/~bzr/bzr-gtk/trunk All changes applied successfully.

Check what has changed:

$ bzr diff

If you're happy with the changes, you can commit them to your personal branch:

$ bzr commit -m "Merge from main branch" Committed revision 295.

Merging your work into the parent branch

After you've worked on your personal branch of bzr-gtk, you may want to send your changes back upstream to the project. The easiest way is to use a merge directive.

A merge directive is a machine-readable request to perform a particular merge. It usually contains a patch preview of the merge and either contains the necessary revisions, or provides a branch where they can be found.

Replacing mycode.patch, create your merge directive:

$ bzr send -o mycode.patch Using saved parent location: http://bazaar.launchpad.net/~bzr/bzr-gtk/trunk

You can now email the merge directive to the bzr-gtk project who, if they choose, can use it merge your work back into the parent branch.

Learning more


To learn about Bazaar on the command-line:

$ bzr help

To learn about Bazaar commands:

$ bzr help commands

To learn about the ''foo'' topic or command:

$ bzr help foo


No comments: