Undo a Single File in Git

I just had a need to undo (reset) a single file while I was working on multiple files. I was just testing stuff in different files and I wanted to undo the changes in a single file. Here is what you can do.

git checkout HEAD -- myfile

I think I did this before but I had forgotten it. I’m hoping to remember it by blogging it and help someone out there. 🙂

Leave a Reply

Your email address will not be published.