To find the latest git commit across all branches, build up the command piece by piece.

List all remote branches:

git branch -r

(If you want to look at local branches instead, drop -r. You can also write --remote instead of -r.)

Skip HEAD:

git branch -r | grep -v HEAD

-v inverts the match; --invert-match works too.

Show a branch’s tip commit with a date:

git show --format="%ci %cr" branch_name

%ci is the committer date in ISO 8601; %cr is the relative committer date.

Sort the results, newest first:

sort -r

Putting it all together:

for branch in `git branch -r | grep -v HEAD`; do
  echo -e `git show --format="%ci %cr" $branch | head -n 1` \t$branch
done | sort -r | head -1

Run it from the repo root to get the most recent commit across every remote branch.

Thanks Kirti for the question.

Hope this helps.

© 2026 Dhanendra Kumar