Reputation: 15736
So I have 2 branches, master and let's say hotfix
So when I checkout to the hotfix branch and create some file there and then checkout back to the master, I still can see that file in the directory, even though it's a different branch and I wonder if there's a way to separate files from those two directories, so when I checkout to the hotfix branch, that file is present and when I checkout to the master, that file shouldn't be there.
Upvotes: 2
Views: 220
Reputation: 382122
The file isn't changed by git when you change branch unless git knows it.
What you forgot is to add, then commit the file before you came back to master. When you do it, the file is removed when you change branch to master, and restored when you change again to the hotfix branch.
Upvotes: 3