Git branch management-view branches
View branches
$ git branch
iss53
* master # 带星号*表示当前所在分支
testingThe git branch command can not only create and delete branches.If you run it without any parameters, you will get a list of all current branches.
View the last commit of each branch
$ git branch -v
iss53 93b412c fix javascript issue
* master 7a98805 Merge branch 'iss53'
testing 782fd34 testView merged branches
--merged and --no-merged are two options to see which branches have been merged or not merged into the current branch.
$ git branch --merged # 查看已合并分支列表
iss53
* masterBranches in the above list without * before the branch name can usually be deleted using git branch -d;
$ git branch --no-merged # 查看未合并的分支列表
testingThe above shows an unmerged branch, and trying to delete it using the git branch -d command fails:
$ git branch -d testing
error: The branch 'testing' is not fully merged.
If you are sure you want to delete it, run 'git branch -D testing'.Force deletion of unmerged branches:
$ git branch -D testingView the (un)merged branches of the specified branch
Options described above --merged and --no-merged Will list merged or unmerged into respectively when no commit or branch name is given as argument. current Branches of branches.
You can always provide an additional argument to see the merge status of other branches without having to check them out.For example, what hasn't been merged into the testing branch yet?
$ git branch --no-merged testing
topicA
featureB