I've been playing around with Git recently to get a grasp of distributed version control. Now I'm looking at Bazaar, but can't figure out how to make a local branch, i.e. a branch that I do not have to push to when I want to commit changes. With Git, I would do
git branch branch_name
or
git checkout -b branch_name
I can then work in my local branch, committing changes as I go, without having to push changes to a remote repo. When I'm through with the branch, I can merge it to my local master branch. If I want, I can then push those changes to the remote repo.
Is this possible with Bazaar? Bazaar seems much more like SVN, with branches just being separate directories, so maybe not.
Old question, but it appears that colocated branches are the way to go for this nowadays. Bzr includes a plugin with various convenience functions, including
colo-init
for creating colocated-branch-enabled repositories andcolo-branch
for actually using/creating branches (I have not made extensive use of these features yet, so I may have this a bit jumbled..)If you set up your repository the correct way, you can work in a similar fashion to git.
This will create a structure like so:
And if you want to make branches, you can do the following:
and now you'll be in the
some-feature
branch, which will be at the same point as mainline.bzr differs from git in that you can't switch the branch represented by the working directory. You can branch from your working directory, though, instead of having to branch from the remote repository. So instead of
you would do
Yes, you definitely can do that.
Let's say there's a remote repository at bzr+ssh://foo.com/repo/mainline
You can create a local branch by doing:
Now, you can make changes to the local_branch and commit them, and those changes are only in that local directory. e.g.:
That will add foo only in the local branch.