I have been using git for few months. I thought I had understood the behaviour of file changes within a branch in a certain way. I am seeing some different behavior. Could someone help clarify.
I have 2 branches master and dev.
I create a new file called test_file in dev branch. When I run git status, it shows me test_file is a untracked file now.
I run a git checkout master to switch to the master branch. When I run a git status, it shows me the test_file is a untracked file there as well.
Question: My assumption was a file created in one branch will not be seen in another branch, unless I have commited the branch (dev) and merged it with other branch (master). Is my understanding wrong?
- If I add the test_file to index (git add test_file), commit the file in devl branch, I no longer see the file in master branch.
Question: does this mean the file will not be seen in other branches (master) only when it’s commited in a branch (dev).