What about conflicts with local files when using git pull files?

Source: Internet
Author: User
Tags using git

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?

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.