To reset my last commit, I did this:
git reset --soft HEAD^
But I did it too many times. Now I want to go back forward a couple. Is that possible?
Also, I had a developer pull and merge code on a production application that completely hosed up everything. Then to fix it, he manually overwrote some files in the app source. There are bad commits. The applications is not functioning.
Is there some way to do a hard reset to a particular point in time in Git? I am not familiar enough with it.
Use
git reflogto see where you were and reset to that. (or use notation likeHEAD@{1}in reset )For the other issue, from
git logget the hash of the commit you want to reset to and dogit reset --hard <sha1>. Or you can even dogit reset --hard HEAD@{1 day ago}etc. if you wanted to reset to some commit some time in the past. Since you are rewriting history, you will have to do a force push –git push -fAlso, why are developers pushing to production? Have gates – CI, testing, etc.