我使用下面的命令来查找局部GIT分支branch-name
存在于我的存储库中。这是对的吗?有更好的办法吗?
请注意,我是在脚本中这样做的。出于这个原因,如果可能的话,我想远离命令。
git show-ref --verify --quiet refs/heads/<branch-name>
# $? == 0 means local branch with <branch-name> exists.
git rev-parse --verify <branch-name>
# $? == 0 means local branch with name <branch-name> exists.
相似问题