Git conflict: Commit your changes or stash them before you can merge. Solutions

Source: Internet
Author: User
Tags using git

When you update your code with GIT pull, you encounter the following problem:

Error:your local changes to the following files would is overwritten by merge:      xxx/xxx/xxx.php please  , commit R changes or stash them before you can merge.  Aborting

This problem occurs because others have modified the xxx.php and submitted to the Repository, and you have modified the xxx.php, you have a git pull operation is a good conflict, the solution, in the above hints also said very clearly.

1, the modification of the local reservation modification method

1) Direct Commit local modification

2) via Git stash

Git stashgit pullgit stash pop

By using Git stash to restore the workspace to the last commit, and back up the local changes, you can then git pull, and after Git pulling is done, the git stash pops are applied to the current workspace with the previous local modifications.

Git stash: Backs up the contents of the current workspace, reads the content from the most recent commit, and makes the workspace guarantee consistent with the last commit. At the same time, save the current workspace content to the git stack.

Git stash pop: reads the last saved content from the Git stack and restores the workspace. Because there may be multiple stash content, the pop reads the content from the most recent stash and recovers it by using a stack to manage it.

Git stash list: Displays all the backups in the GIT stack and can use this list to decide where to recover from.

Git stash clear: Empty the git stack. Using graphical tools such as GITG, you will find out which nodes of the original stash have disappeared.

2, discard the modification of local modification method

git Reset--hardgit Pull
Transferred from: http://www.letuknowit.com/post/144.html

Git conflict: Commit your changes or stash them before you can merge. Solutions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.