Git pull encountered an error: Error:your local changes to the following files would is overwritten by merge:

Source: Internet
Author: User

Today, when you pull the server's code to local with Git pulls, you encounter an error, Your local changes to the following files would is overwritten by merge:, you can use the following methods to resolve:

Method 1: If you want to keep the code that you have just modified locally and pull the code on the GIT server locally (the code you just modified will be temporarily locked up)

Git Stashgit pull Origin mastergit stash Pop

As a result, the code on the server is updated locally, and your locally modified code is not overwritten, and the local code is updated to the server using the Add,commit,push command.

Method 2, if you want to completely overwrite the local code, leaving only the server-side code, then directly fall back to the previous version, and then pull:

Git reset--Hardgit pull Origin Master

Note: Where Origin master represents the main branch of Git.

Git pull encountered an error: Error:your local changes to the following files would is overwritten by merge:

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.