首先在master下创建了一个txt文件,然后git checkout -b dev
创建了一个新的分支,在dev分支下更改了txt文件内容,结果直接返回master分支成功了,并且,内容也一并更新了,这是什么问题,应该怎么改?
怎样修改才会不同步呢?
过去多啦不再A梦2017-05-02 09:26:34
Did you switch back to master directly without committing under dev?
In this case, your changes are still in the cache and do not belong to any branch. So after you switch to master, you find that the content has been updated.
The normal process is to commit to the dev branch first, and then merge to the master.
So you should now checkout to dev again, and then perform the above commit and merge operations.
In fact, if your master also changes the same file, git will prompt you that you cannot switch from dev to master unless you commit first or stash the cache.