Dangit, I did something terribly wrong, please tell me git has a magic time machine!?!
git reflog
# you will see a list of every thing you've
# done in git, across all branches!
# each one has an index HEAD@{index}
# find the one before you broke everything git reset HEAD@{index}
# magic time machine
You can use this to get back stuff you accidentally deleted, or just
to remove some stuff you tried that broke the repo, or to recover
after a bad merge, or just to go back to a time when things actually
worked. I use reflog A LOT. Mega hat tip to the many many many many
many people who suggested adding it!
“git reflog”列出最后几个标题。 选择所需更改的提交id。 git重置为该提交id
资料来源:https://dangitgit.com/en#magic-time-machine
相关问题 更多 >
编程相关推荐