Please, commit your changes or stash them before you can merge

See also:

https://blog.csdn.net/iefreer/article/details/7679631

 

Use git pull to update the code, I encountered the following problems:

error: Your local changes to the following files would be overwritten by merge:

     xxx /xxx/xxx .php
Please, commit your changes or stash them before you can merge.
Aborting

  

 

This question appears because other people xxx.php revised and submitted to the repository to go, and you have modified the local xxx.php, this time you perform operations like git pull a conflict, the solution, in the above tips also said very clearly.

1, modified to keep local change method

1) Direct commit local modifications also generally do not use this method ----

2) git stash ---- usually by this method

git stash
git pull
git stash pop

  

By git stash to restore the contents of the work area to the last commit, but backup changes made locally, then you can git pull a normal, after git pull, run git stash pop to before the local changes made to the current workspace .

git stash: backup of the contents of the current work area, reading relevant content from a recent submission, so that the work area and to ensure consistency with the text of the last commit. At the same time, to save the current workspace content to Git stack.

git stash pop: read the last saved content from Git stack, reinstate the work area. Because there may be multiple Stash of content, so use to manage the stack, pop reads content from a recent stash and recovery.

git stash list: display all backups within the stack Git, you can use this list to decide to recover from that place.

git stash clear: empty Git stack. This time using graphical tools such as gitg will find the original stash which nodes are gone.

2, give up the modification of the local change method ---- This method discards code locally modified, and can not be retrieved

git reset --hard
git pull

  

 

Guess you like

Origin www.cnblogs.com/kaerxifa/p/10966330.html