您的位置:首页 > 其它

How to list and delete branches

2016-07-29 16:15 344 查看

List branches

# list your local branches
$ git branch

# list your remote branches
$ git branch -r

# list both remote and local branches
$ git branch -a


See the last commit on each Branch

$ git branch -v


List merged or not merged branches

# list the branches that are already merged into the branch you're on
$ git branch --merged

# list the branches that contain work you haven't yet merged in
$ git branch --no-merged


Delete branches

# delete a local branch
$ git branch -d <<local_branch_name>>

# delete a remote branch
$ git push origin :<<remote_branch_name>>


If you have other branches that contain work that haven’t merged in yet, trying to delete it with
git branch -d
will fail.

But if you really do want to delete the branch and lose that work, you can force it with -D.

# force to delete an unmerged branch
$ git branch -D <<local_branch_name>>


Reference

Git Branching - Branch Management

How to list and delete branches
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  git branch list delete merge