I'm doing ruby on rails, and I messed up I want to go back to the previous step I saved on github. problem is I don't know how to go back, do I delete my files and paste the one I saved on github? is there an easier way I can do it on gitbash?
Asked
Active
Viewed 64 times
-2
-
4It would appear your best bet at this point is to [learn git with GitHub](http://try.github.com). – Brandon Buck Mar 06 '15 at 19:09
-
git is pretty much designed for being able to go through your code history. there is a much more elegant and simple way than deleting files and pasting them in. Check out this s.o. question http://stackoverflow.com/questions/4114095/revert-to-a-previous-git-commit – sova Mar 06 '15 at 19:31
1 Answers
0
If the previous step if the one you pushed to GitHub (meaning the same sha1 that you would see for origin/master
when doing a git branch -avvv
), all you need is:
git reset --hard origin/master
You current branch (I assume master) is reset to origin/master
, and you can resume your work from the same point as the last one you pushed to GitHub.

VonC
- 1,262,500
- 529
- 4,410
- 5,250