Get the current git commit from a file


If you need to get the current commit, but don’t want to run git rev-parse HEAD, you can get it from .git/refs/heads/master where master is the branch you are interested in.

Tags:  git

Share: