What should I do if the gitpull file conflicts with the local file? When using git pull code, conflicts often occur and the following information is prompted:
Error: Your local changes to 'C/environ. c' wocould be overwritten by merge. Aborting.
Please, commit your changes or stash them before you can merge.
This means that the updated content conflicts with the locally modified content. submit your changes or temporarily store the local changes.
The processing method is very simple, mainly by using the git stash command for processing, divided into the following steps for processing.
1. store local modifications
$ Git stash
In this way, all local modifications will be temporarily stored. Is to use git stash list to view the saved information:
Temporary git stash modification
Temporary git stash modification
Stash @ {0} is the saved tag.
2. pull content
After local modifications are saved, you can use pull.
$ Git pull
3. restore the saved content
$ Git stash pop stash @ {0}
The system prompts the following similar information:
Auto-merging c/environ. c
CONFLICT (content): Merge conflict in c/environ. c
This means that the system automatically merges the modified content, but there is a conflict in it, and the conflict must be resolved.
4. resolving conflicts in files
Open the conflicting file and you will see something similar to the following:
Git conflict content
Git conflict content
The content between Updated upstream and ==== is the content of pull, and the content between ==== and stashed changes is the content of local modification. In this case, git does not know which line of content is required, so you need to determine the required content on your own.
After the solution is completed, you can submit it normally.