Deleting directory in branch causes directory in master to be deleted on switch?
git
Solution
Why when i remove files from a branch are those actions reflected on my master branch ?
Because you modified the working tree: when you switch back to `master`, if `master` didn't have modifications done on `secret_code`, it will keep the working tree as is, and the `git status` will reflect the deletion of that folder.
This would remove `secret_code` only in `test` branch:
git checkout test
git rm -r secret_code
git add -u .
git commit -m "removes secret_code in test"
Then:
git checkout master
You would still see `secret_code` in that `master` branch.
Problem
In my git repo master branch i have working dir /tmp/repo_name/secret_code. If i switch to new branch called test and then `rm -rf secret_code`.. when i change back to master it deletes the secret_code directory from there as well. I thought if i make changes on a git branch that it acts as a container for changes so on changing to another branch the working dir will reflect that branches state. Why when i remove files from a branch are those actions reflected on my master branch ? Thank you.