I am trying to use branches to work on different parts of my project. Let's say I am on the master branch and I have a file test1
on it. Now, I create another branch and switch to it:
git branch first_branch
git checkout first_branch
Now I create another file, say test2
and add some content to it. Now when I switch branch to master
, I get:
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
But when I check the files now, I see the file test2
with all the contents! How is that possible? I tried with multiple branches and everything simply gets copied across all the branches. This is not what I want since I want to keep my experimental work separate from an established work.