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

Answer by v.babak for How to get the current branch name in Git?

$
0
0

Get local branch name only:

git status -b -u no | awk 'NR==1{print $3;}'

Get remote branch name only:

git status -b -u no | awk 'NR==2{print $6;}'

and git status -b -u no | awk 'NR==2{print $6;}' | tr -d "[.']" to delete special characters from the output


Viewing all articles
Browse latest Browse all 96

Trending Articles



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