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
CodePudding user response:
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
.
CodePudding user response:
in git when you squash commits actually you are deleting them from the history, so, you don't have any chance to rollback (as I know) but try the following command :
git log
if you find your commit you can open it in temp branch by using this command :
git checkout COMMIT_HASH