I thought it was git reset --hard but in addition to reverting to an old version that deleted all my local changes since I had last pushed to the server! Now I have to redo an hour's worth of work... thank God I pushed last night or I'd be screwed!
            Asked
            
        
        
            Active
            
        
            Viewed 197 times
        
    1 Answers
2
            Use git checkout -b new_branch_name your_commit_hash. 
If you don't use -b new_branch_name it will end up in a detached HEAD state.
 
    
    
        Marlon Abeykoon
        
- 11,927
- 4
- 54
- 75
- 
                    Why would I want to create a new branch? I just want to load up an old version of the code to compare how it behaves with the latest version; I don't intend to make additional changes. BTW I found an article which told me how to recover from a `git reset` - I had to use `git reflog` to find the latest "good" commit (it's not actually deleted!) and then `git reset` to that particular commit ID and now everything is back! :D – ekolis Jul 16 '19 at 15:06
- 
                    yes then simply ignore the -b flag and use `git checkout your_commit_hash` – Marlon Abeykoon Jul 16 '19 at 15:07
