git conflict resolution

Original link: http://blog.csdn.net/iefreer/article/details/7679631


If there are some configuration files in the system that have been modified on the server, and then some new configuration items are added in subsequent development,

this is published When configuring files, code conflicts will occur:

error: Your local changes to the following files would be overwritten by merge:
        protected/config/main.php
Please, commit your changes or stash them before you can merge.

If you want to keep the production server The changes made above are only merged into the new configuration items, and the processing method is as follows:

git stash
git pull
git stash pop
Then you can use Git diff -w + file name to confirm the automatic merge of the code.



Conversely, if you want to use the code base The files in the file completely overwrite the local working version. The method is as follows:

git reset --hard
git pull
where git reset is for the version, if you want to roll back local modifications to the file, use

[plain] view plain copy to view the code snippet on CODE derived to my snippet
git checkout HEAD file/to/restore 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326316836&siteId=291194637