擅长:python、mysql、java
<blockquote>
<h3>Dangit, I did something terribly wrong, please tell me git has a magic time machine!?!</h3>
<pre class="lang-sh prettyprint-override"><code>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
</code></pre>
<p>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 <code>reflog</code> A LOT. Mega hat tip to the many many many many
many people who suggested adding it!</p>
</blockquote>
<p>资料来源:<a href="https://dangitgit.com/en#magic-time-machine" rel="nofollow noreferrer">https://dangitgit.com/en#magic-time-machine</a></p>