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

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

$
0
0

Tried above answers but there is always 'detached HEAD' issue that comes with several commands. This ones works for me so far. It will correctly output the branch name even if the branch name contains / in the name

git describe --all --exact-match | sed 's/heads\///'

Viewing all articles
Browse latest Browse all 96

Trending Articles



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