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