Let's start with the situation.
- I recorded some changes (5 files)
git stash - Change some files
- Commit changes
git commit -m "Commit message" - Get changes back from stash
git stash apply
I get a merge conflict in 2 files due to commit. I no longer want changes to these two files. So I tried to revert these changes.
I did git checkout -- background.js
Error with error
error: path 'src / background / background.js' is not marked
But then I read this SO post and tried
git checkout HEAD -- background.js
It works successfully. This happened to me for both files. I want to understand the difference:
git checkout -- file AND git checkout HEAD -- file
source
share