After git checkout old_branch, the content changed in new_branch is also updated. What should I do?
仅有的幸福
仅有的幸福 2017-05-02 09:24:34
0
1
569

First created a txt file under the master, then git checkout -b dev created a new branch, changed the content of the txt file under the dev branch, and the result was directly returned to the master branch successfully, and the content was also updated. , what is the problem and how should it be corrected?

How to modify it so that it will be out of sync?

仅有的幸福
仅有的幸福

reply all(1)
过去多啦不再A梦

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template