Git new file appears in all branches
I thought a file created on one branch will not appear in any other branches until I merge or rebase the branch?
I have two branches:
I checkout the new_contact_page branch.
$ git checkout new_contact_page
Then I create a new file.
$ vi contact_page.html
Without doing any Git commands, I switch back to my Master branch.
$ git checkout master
Then I see that this contact_page.html file is also in my Master branch.
$ ls (contact_page.html shows up in the list!)
Shouldn't the file only exist in new_contact_page branch?
Git will never touch any files that aren't actually in your repository. (untracked files)
You need to git add and git commit the file (into one branch) first.