I git pulled without saving changes made on local repo

Viewed 20

I made changes on local repo, but forgot to commit the changes. I ran git pull and now I've lost the code I added on local repo. How do I reverse changes made on local repo after running git pull, or reverse a git pull to go back to the unstagged changes.

1 Answers

git pull means:

  1. run git fetch; then (assuming step 1 succeeds)
  2. run a second Git command.

That second Git command is the one that caused problems. Exactly what problems, we can't tell you until you tell us which second Git command you chose to have git pull run.

(If the second command was git rebase and you set up rebase to use autostash and the rebase failed—none of which you showed in your question: see How do I ask a good question?—then I know what happened, but if not, it's not clear. Meanwhile StackOverflow is being balky, despite StackStatus saying everything is fine.)

Related