Ok, when I switch between branches, and delete a file from one branch it is carried over into the other.
I created a new repo, and pushed to a remote with a file "README.md".
I then switch to a feature branch git checkout -b feature/hello
and add a file hello.md
. I add this file git add hello.md
and commit git commit -m "hello added"
. I then push this branch and everything is great! git push origin feature/hello
.
Now I want to switch branch to do some work, and on this feature branch we are going to remove hello.md
and add a new file goodbye.md
.
git checkout -b feature/goodbye
rm hello.md
git checkout feature/hello
Now in the feature/hello
branch I have the files README.md
goodbye.md
.
Why does deleting files in one branch remove them from another?