I don’t know what happened. git created a new branch and then modified it in the branch. As a result, the master was also changed simultaneously. Shouldn’t it be that before the merge, the modifications in the branch did not affect the master?
Here are all my branches git branch -a
dev
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
Excuse me, what is going on?
@bordertownmadman I created the branch through git checkout -b. . . I just switched over, and then I created and modified files in the branch. After committing, I returned to master and found that the previously created and modified files were synchronized before they were merged. .
I cloned it again and created a new branch. It seemed to be fine. I don’t know why--!
Are you sure you switched branches through checkout after creating the branch?
If there is no switch, you are still on the original branch
Look
in itgit help branch
, there is a sentenceThat is, the one marked with an asterisk is the current branch... so you are not currently on the
dev
分支上,还是在master
branch.Are you sure you committed and then checked out? Did you get the order wrong? Do you checkout first and then commit?