DEV Community

Discussion on: Easily get current branch name in git

Collapse
 
mgtitimoli profile image
Mauro Gabriel Titimoli • Edited

I was used to do the following

git branch | grep -e "^\*" | cut -d " " -f 2

This alternative, as it happens a lot with git, doesn't expose its purpuse clearly, but at least it provides a way to get the current branch, so I guess I will move to this approach instead.

Thanks for sharing!