Git pull error

created at 07-03-2021 views: 3

error message

Your local changes to the following files would be overwritten by merge
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.

solution

If you want to keep the changes made on the production server and just merge the new configuration items, 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 merging of the code.

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

git reset --hard
git pull

Among them, git reset is for the version. If you want to roll back the local modification for the file, use

created at:07-03-2021
edited at: 07-03-2021: