Reputation: 9912
I have the following situation. A commit where my project works. The next commit where something horrible that I can not explain happens. So
badcommit (HEAD->master) How horrible!
goodcommit Here it works
so I did git checkout goodcommit
and I got my project working again! (pheew!).
goodcommit(HEAD) Here it works
So now I want to start from here and forget that horrible experience. I read you can revert a commit. So How can I put master in goodcommit and continue from there?
(I read very complicated answers but I remember it was very simple: a one line command that took the last commit and reverted to the previous one, not -like I read- a series of complicated commands)
Upvotes: 0
Views: 690
Reputation: 702
You can use following commands,
git log
It will provide you list of your previous commits, copy that long string from the commit, then use
$ git reset --hard <COMMIT -ID>
Example: git reset --hard 6504ab87416af0571ae628511207813f20bb2d2c
That's it.
Upvotes: 2