Quantcast
Channel: How do I get the current branch name in Git? - Stack Overflow
Viewing all articles
Browse latest Browse all 96

Answer by roberttdev for How do I get the current branch name in Git?

$
0
0
git branch

should show all the local branches of your repo. The starred branch is your current branch.


To retrieve only the name of the branch you are on:

git rev-parse --abbrev-ref HEAD

or with Git 2.22 and above:

git branch --show-current

Viewing all articles
Browse latest Browse all 96

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>