How to properly remove a bazaar branch?

2019-06-24 11:47发布

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?

2条回答
啃猪蹄的小仙女
2楼-- · 2019-06-24 12:41

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
查看更多
老娘就宠你
3楼-- · 2019-06-24 12:42

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.

查看更多
登录 后发表回答