How can I check with the command line the latest commit hash of a particular Git branch?
Try using git log -n 1
after doing a git checkout branchname
. This shows the commit hash, author, date and commit message for the latest commit.
Perform a git pull origin/branchname
first, to make sure your local repo matches upstream.
If perhaps you would only like to see a list of the commits your local branch is behind on the remote branch do this:
git fetch origin
git cherry localbranch remotebranch
This will list all the hashes of the commits that you have not yet merged into your local branch.