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