0

I've modified a file, then I want to get latest version from remote.

So I run git checkout to revert the file, and run git pull to get latest version.

After that, I found that I need the modification of the file.

Is it possible to get it back? Thanks!

Zoe
  • 27,060
  • 21
  • 118
  • 148
Dong
  • 911
  • 2
  • 9
  • 25

2 Answers2

2

Use "git stash" to stash all of your changes, "git pull" to update your repository, and then "git stash apply" to apply your changes back.

Garrett Hyde
  • 5,409
  • 8
  • 49
  • 55
1

If you have done the git checkout -- file to revert than it's too late...simply the changes are lost...A better idea might have been to stash the change instead of reverting it...

khmarbaise
  • 92,914
  • 28
  • 189
  • 235