How to get the current branch name in Git?

后端 未结 30 3136
清酒与你
清酒与你 2020-11-22 07:47

I\'m from a Subversion background and, when I had a branch, I knew what I was working on with \"These working files point to this branch\".

But with Git I\'m not sur

30条回答
  •  醉梦人生
    2020-11-22 08:31

    As of version 2.22 of git you could just use:

    git branch --show-current
    

    As per man page:

    Print the name of the current branch. In detached HEAD state, nothing is printed.

提交回复
热议问题