how to get the current branch name in git code example Example: get current branch name git git rev-parse --abbrev-ref HEAD