Let's begin with a situation.
- I stash some changes (5 files)
git stash
- Change some files
- Commit the changes
git commit -m "Commit message"
- Get the changes back from stash
git stash apply
I receive a merge-conflict in 2 files because of the commit. I no longer want the changes in those 2 files So I tried to revert those changes.
I did git checkout -- background.js
It failed with error
error: path 'src/background/background.js' is unmerged
But then I read this SO post and tried
git checkout HEAD -- background.js
It works successfully. It happened with me for both the files. I want to understand the difference bewteen
git checkout -- file
AND git checkout HEAD -- file