Git list different demanded branches and delete branches both local and remote.
List branches
1
2
3
4
5
6
7
8
$ 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
1
$ git branch -v
List merged or not merged branches
1
2
3
4
5
# 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
1
2
3
4
5
# 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.
近期评论