deepsingh
deepsingh

Reputation: 161

Undo everything git did by using git pull command

I had a previous project code and I started using git in between but due to some reasons I need to get back the code that was before I added git. What I did is as follows.

I ran git init command than I ran git remote add origin command than I ran git pull command which updated all files I think although files were same.

I need to get back files without updation. I started getting 500 error after I ran git pull command.

Please help. Thanks

Upvotes: 0

Views: 73

Answers (1)

Vamsi Ravi
Vamsi Ravi

Reputation: 1236

git pull = git fetch + git merge

Technically you have to undo the merge. (undoing fetch will not make sense anyways)

Get the details of which state you want to undo by git reflog

$ git reflog

Then do a hard reset

$ git reset --hard <sha1>

First 7 alphanumeric in the sha1 from the reflog will do the job

I hope this will undo your pull. Thanks

Upvotes: 2

Related Questions