Search code examples
bazaar

Remove a parent branch in Bazaar


Given the following scenario:

$ bzr init-repo foo
$ bzr init foo/bar
$ cd foo/bar
$ echo 'some text' > a_file
$ bzr add a_file 
$ bzr commit -m 'a commit message' 
$ cd ..
$ bzr branch bar trunk
$ bzr rmbranch bar
bzr: ERROR: Branch is active. Use --force to remove it.

Is it safe to do a bzr rmbranch --force in this situation? Isn't there a more elegant solution?

After doing a bzr rmbranch --force, bzr info still shows ../foo/bar as the parent branch of trunk, how can I change that?


Solution

  • bzr rmbranch simply removes branch at the given location. It's very handy if you need to delete a branch on your server.

    On your local disk it's fine to just use rm or del command (depending on your OS/shell) if you want to delete some branch and tree.

    NOTE: rmbranch does not delete the tree if one is present, just branch object. (And in your example working tree is actually present). For local workspace it's much simpler to use rm.

    Parent branch is recorded in .bzr/branch/branch.conf. You can edit that config file. It doesn't affect branch deleting.