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

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

$
0
0

Short answer:

git branch --show-current

To put it in a variable in a bash script for example:

current_branch=$(git branch --show-current); 

or in Powershell script:

$currentBranch = $(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>