Bound branches are a way to make sure that both a local branch and a remote branch have the same revisions. This is particularly useful if one likes to work on two machines or if one works on a laptop and then pushes a branch into a public place.
Bound branches can be stated in simpler terms. When a branch is bound to another branch, the commits for the branch will be applied to the other branch first.
How do I use bound branches?
General description of setting up bound branches
The general workflow looks something like this:
- Push a branch to somewhere else, perhaps your ISP.
- Make sure the pushed branch is up to date
- cd into the branch that you want to bind to the remote branch
- run the bzr bind LOCATION-OF-OTHER-BRANCH command
An alternative method is to use bzr checkout, which currently defaults to creating a bound branch when not invoked with --lightweight.
Examples of how to set up bound branches
$ cd somebranch/ $ bzr push sftp://firstname.lastname@example.org//home/me/newbranch $ bzr bind sftp://email@example.com//home/me/newbranch/
From now on, commits to the local branch will go to the other branch first.
Or, using checkout
$ bzr checkout sftp://firstname.lastname@example.org//home/me/somebranch
How to make a branch unbound
One can unbind a branch by changing into the working tree of a bound branch and running:
$ bzr unbind
Questions & answers
mutually bound branches
Is it possible/recommanded to have mutually bound branches? For example, working on two different machines, and keeping the branches synchronized.
I would love to see this feature. It would get me one step further to the endeavour of synchronising $HOME.