How to get the current branch name in Git?

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

    Over time, we might have a really long list of branches.

    While some of the other solutions are great, Here is what I do (simplified from Jacob's answer):

    git branch | grep \*
    

    Now,

    git status
    

    works, but only If there are any local changes

提交回复
热议问题