How to get the current branch name in Git?

后端 未结 30 3304
清酒与你
清酒与你 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:32

    git branch show current branch name only.

    While git branch will show you all branches and highlight the current one with an asterisk, it can be too cumbersome when working with lots of branches.

    To show only the branch you are currently on, use:

    git rev-parse --abbrev-ref HEAD
    

提交回复
热议问题