问题
How to properly remove a bazaar branch from a repository?
What if I want to remove a branch completely, so it would be impossible to find if this branch existed?
I'm aware of the remove-branch
command, but are there any alternatives?
回答1:
bzr remove-branch
is the easiest way to remove a branch. If you can't use that command, can you mention why not?
You can also just remove the branch directory manually, e.g.: bzr rm -rf .bzr/branch
. This will however skip several checks that bzr remove-branch
will do.
回答2:
If you want to ditch the branch, you can just use plain rm -rf branch_name
(or similar machinery on Windows, including cleaning Recycle Bin).
Some history still be preserved in shared repository though, and could be found with bzr heads --dead
command. If you absolutely need to be sure no hidden history left you need to do something more involved:
# make new empty shared repository
bzr init-repo /path/to/temp-repo
# branch everything from old repo to temp-repo
bzr branch /path/to/old-repo/branch-1 /path/to/temp-repo/branch-1
...
bzr branch /path/to/old-repo/branch-N /path/to/temp-repo/branch-N
# after that you're ready to delete old-repo and replace it with temp-repo
# newly created repo will have only revisions present in active branches
来源:https://stackoverflow.com/questions/11291240/how-to-properly-remove-a-bazaar-branch