Git revert local commit

broken image
broken image

You could also make the change as a new commit and then do rebase -i in order to squash them both together, but this is about a million times faster. and FML, I didn't put a space after an equals sign. This usually happens to me if I commit, then run tests/linters. # now your last commit contains that change! Mega hat tip to the many many many many many people who suggested adding it! Oh shit, I committed and immediately realized I need to make one small change! # make your change 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. # each one has an index find the one before you broke everything # you will see a list of every thing you've Oh shit, I did something terribly wrong, please tell me git has a magic time machine!?! git reflog So here are some bad situations I've gotten myself into, and how I eventually got myself out of them in plain english. Git documentation has this chicken and egg problem where you can't search for how to get yourself out of a mess, unless you already know the name of the thing you need to know about in order to fix your problem. Git is hard: screwing up is easy, and figuring out how to fix your mistakes is fucking impossible.

broken image