Please tell me there's a better way.
I'm in a git feature branch. It was branched off of master some time ago. Then I made some commits. Later, I merged in latest master, and after that some more commits. The question is what was the SHA when I merged in latest master? How to find that out?
Here's what I did:
I'm in my feature branch and I run:
git log --merges --first-parent
It prints this out:
commit 2c010ef6e94d792f25f7309ed83a2d35e41e5051
Merge: 24b2a2513d6f e2817859ed02
Author: Peter Bengtsson <email>
Date: Thu Feb 26 14:06:24 2026 +0000
Merge remote-tracking branch 'origin' into name-of-my-feature-branch
The SHA that was, on master, at the time of merging, was e2817859ed02 which is the second thing the Merge: 24b2a2513d6f e2817859ed02 line.
Now, equipped with this I can go back in time git checkout e2817859ed02 and on that detached HEAD, I can do things like run (unit) tests to see if the master branch was busted at the time I merged it into my feature branch.
Comments