Get the current branch name
Prints the current branch name.
- Use
git rev-parse --abbrev-ref HEAD
to print the name of the current branch.
git rev-parse --abbrev-ref HEAD # Examples git checkout patch-1 git rev-parse --abbrev-ref HEAD # Prints `patch-1`