Does anyone know how to get the latest SHA of a given branch from outside a git repository?
If you are inside a git repository, you can do:
Use rev-parse
git rev-parse origin/master # to get the latest commit on the remote git rev-parse HEAD # to get the latest commit on the local