When working with Git pull code, colleagues often encounter conflicting situations, prompting the following information:
Error:your local changes to ' C/ENVIRON.C ' would is overwritten by merge. Aborting.please, commit your changes or stash them before you can merge.
This means that there is a conflict between the updated content and the locally modified content, either by committing your changes or by temporarily storing the local changes first.
The process is very simple, mainly using the git stash command for processing, divided into the following steps to deal with.
1. Store local Modifications first
$ git stash
This allows all local modifications to be temporarily stored. is to use Git stash list to see the saved information:
Git stash Staging changes
where [email protected]{0} is the tag you just saved.
2. Pull Content
After the local modifications are staged, the pull is ready.
$ git pull
3. Restore staged content
$ git stash pop [email protected]{0}
The system prompts similar information as follows:
Auto-merging c/environ.cconflict (content): Merge conflict in C/ENVIRON.C
This means that the system automatically merges the modified content, but there are conflicts that need to be resolved.
4. Resolve conflicting parts of the document
Open the conflicting file and you will see something similar to the following:
Git conflict content
The content between updated upstream and ===== is the content of pull down, and the content between = = and stashed changes is locally modified content. In this case, Git does not know what line of content is needed, so you have to decide what you want.
Once the resolution is complete, it can be submitted normally.
What about conflicts with local files when using git pull files?