TL;DR I can't revert a file with git checkout if a branch has the same name.
I was working on my GIT repository when found a funny problem. We've a branch called "build-upload" where we are creating a new "upload" feature. We also have a file called "bin/build-upload", it's a script than builds the project and uploads it to production.
The thing is I was on the "bin/" directory and modified "build-upload" file and I want to revert it. So I typed
git checkout build-upload
And the result was
amatiasq:~/repo/bin$ git checkout build-upload
M bin/build-upload
Switched to branch 'build-upload'
I didn't pay enought attention to the result, and continued working without realizing I was on another branch. Fortunately before I commit the new changes I saw "bin/build-upload" was modified and this led me to found I switched branch.
The question is. Is there a way to prevent this ambiguity? How can I tell git when I do "checkout" if I want to switch branch or revert a file?