Reflog
λ git log --oneline d889863 Flexbox 1st commit a70a8d1 GitBook API Example sdfdsd3 GitBook API Example2 sdfdsg2 GitBook API Example3
λ> git reflog
d889863 HEAD@{0}: commit: Flexbox 1st commit
a70a8d1 HEAD@{1}: clone: from https://git.gitbook.com/hemantajax/css-flexbox.git
sdfdsd3 HEAD@{2}: commit: 2nd commit
sdfdsg2 HEAD@{3}: commit: 1st commit
if you do git reset --hard a70a8d1
then you have only one commit in your history
git log --online
a70a8d1 HEAD@{3}: commit: 1st commit
What if you want to take your history ( other 3 commit back )
git reflog HEAD@{0}
// now detached state
// merge to master
git checkout -b my-branch
git checkout master
git merge my-branch
Last updated
Was this helpful?