Git: pull时提示Please commit your changes or stash them before you merge

After we modify the local code, if we git pull directly, it will prompt that the local code conflicts with the github code. We need to commit the local code first, or stash them.

There are two ways to solve this problem:

1. I want to keep the local changes. After the pull, the changes still exist.
git stash
git pull 
git stash pop
analysis:
git stash: hide the changes
git pull: overwrite the local code with new code
git stash pop: restore the changes
that have just been hidden local changes

2. Do not retain local modifications, directly overwrite

git reset --hard
git pull

{{o.name}}
{{m.name}}

Guess you like

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