How can I get the current branch or tag name for my working copy? I have seen references that indicate rev-parse --abbrev-ref HEAD will give branch name, but t
rev-parse --abbrev-ref HEAD
This command can print name in this priority: tag > branch > commit
tag
branch
commit
git describe --tags --exact-match 2> /dev/null \ || git symbolic-ref -q --short HEAD \ || git rev-parse --short HEAD