0

I would like to recover myfile.py following a wrong git operation.

This is what I did:

git add myfile.py
git checkout 0ddb6x myfile.py (wrong operation, which changed the content myfile.py on my local machine)
made some change on myfile.py
git add myfile.py (wrong operation)

Now I hope go go back to myfile.py before checkout. Is it possible?

zell
  • 9,830
  • 10
  • 62
  • 115

1 Answers1

0

So you added the file, then checked it out again. That checkout should have done nothing, meaning for all intents and purposes, all you did was a git add.

By doing another git add after making changes, you have added those changes into the index, where it records what files look like before committing them.

What are you trying to go back to, exactly? The file on disk can only be reverted to a time before any git add commands were issued.

Teknikal_Domain
  • 318
  • 1
  • 11