I have a repository where I created a new branch “test” and added a few files, made a few modifications. However, I see that when I switch back to the “master” branch the files I created in “test” are present in “master”.
Why does this happen?
[EDIT]
I figured out the reason for my confusion. I had performed a “git pull” which caused a merge. As a result I had files from my “test” branch in my “master. I hadn’t realized that pull would be a fetch followed by a commit.
If you don’t commit your files in the branch they remain on your workspace.
So while in your branch you should:
When your switch on the master the files aren’t there anymore.
When you’re in the test branch, you’ll see your new files as untracked until you dont add them to the index (with git add) and them commit them (git commit).
To see if you have untracked files: