I am learning git. I have created a new branch named 'development' and in that branch when I am creating a file it is automatically adding to the main branch even I did not staged that file.
In the main branch
there was two files named one.txt
and two.txt
.
I just checkout to development branch by
git checkout development
Then I created a file named three.txt
by echo three > three.txt
in the development branch
. I did nothing after creating the three.txt
file. I even didn't staged the file.
After crating the file I checkout to the main branch
and I saw three.txt
there. But how it is possible?
I don't want to have the file in main branch
before I merge it.
This is happening like sync system. If I staged a file form any branch it is automatically staged in the main branch and vice-versa. What is the solution? How can I solve this problem? Help me please.
OS: Windows 10
git version: 2.32.0
I used both power-shell and git-bash and getting same result.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…