I'm currently having a problem trying to retrieve the current git branch
and the current git SHA of a repository, the main problem being that the
method I'm using does not work in different versions of git. Right now I'm
pulling out this information with the following two commands:
# first seven chars of the SHA
git rev-parse --short HEAD
# current branch name
git rev-parse --abbrev-ref HEAD
The second command does not work in git 1.7 and lower (I think), the first
command only works in versions greater than or equal to 1.5.2. *What would
be a more effective way to achieve this without having to check for the
current git version*?
What I would like would be a command that would work in any git version or
that has the greatest coverage for the multiple versions available.