In a repository with squash-merge practice, can I go to the state of the repository in one of the squashed commits?
For the example below, I want to find commit m1
by checking out commit r1
.
m1 - m2 ------- m3 <- master (r1, r2, and r3 are squashed into m3)
\
r1 - r2 - r3 <- deleted branch
You can use git reflog --all
. It lists all recent actions and related commit hashes. If you find the commit there, you can git checkout <commit_hash>
.
Note: --all
option is for listing reflogs of all references, not just the HEAD
.