3 ms·
Reflog is your friend. git break-my-shit git reflog ... output saying where you were before things broke ... grab the good commit sha
by fragmede 2y ago
Reflog is your friend.
git break-my-shit
git reflog
... output saying where you were before things broke
... grab the good commit sha
git reset --hard good_commit_sha_from_reflog
- compiler-guy 2y agoAnd yet up above we have others recommending to never, ever, use `git reset --hard ...`.
- psyclobe 2y agoThe same people probably want to ban knives!
- spokaneplumb 2y agoThe copy-the-.git-dir trick works for worse issues than can be solved with a single reset --hard. Damn near anything, really, as long as you haven't touched any remotes. It also works if you don't remember/understand how you broke it, where it's broken, or which state you need to try to reset to.