只显示Git中的当前分支 [英] Show just the current branch in Git
本文介绍了只显示Git中的当前分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图寻找一个特殊的git命令,但找不到一个。任何人都可以提出比以下任何更短或更快的建议:
git branch | awk'/ \ * / {print $ 2; }'
解决方案
$ git rev-parse --abbrev-ref HEAD
master
这应该适用于Git 1.6.3或更新。
I tried looking for a special git command for this but couldn't find one. Can anyone suggest anything shorter or faster than:
git branch | awk '/\*/ { print $2; }'
解决方案
$ git rev-parse --abbrev-ref HEAD
master
This should work with Git 1.6.3 or newer.
这篇关于只显示Git中的当前分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文