git: looking at the most recent engagement of a non-current local branch

advertisements

I'm on the master branch. I want to see the commit hash of the last commit in branch xxx.

I tried

git checkout xxx
git log | head

It's cumbercome. I bet there's a way to peek at this information without the heavy handed "checkout"

Any ideas?


You can append branch name after many commands which otherwise take a current branch or HEAD by default. For example:

$ git log <BRANCH>

or

$ git show <BRANCH>