Please commit your changes or stash them before you merge, commitstash

Source: Internet
Author: User

Please commit your changes or stash them before you merge, commitstash
Preface

Recently, gitlab has been used for version control and collaborative work. It is not very familiar with the use of git, and git is only used in the git bash command line, summary of bugs encountered during git usage

Problem:

The following occurs when git pull is used:

Error: Your local changes to the following files wocould be overwritten by merge: xxx/xxx. java Please, commit your changes or stash them before you can merge. Aborting

Most of these problems are due to conflicts that occur when files are modified and code is not submitted to the remote repository in a timely manner.

There are two ways to solve this problem (cainiao like me prefer the second solution, mainly because I don't need to think too much ):

1. stash Method

Git stashgit pullgit stash pop

2. Discard local modification and overwrite it directly

Git reset -- hardgit pull

I usually choose the 2 method, because my approach is:

If you are not sure, back up the locally written code first, and then I will give up the local modification and pull a copy from the server, then, overwrite the file I want to modify, and then proceed.

Git add. git commit-m "xxx" git push origin master

It is not a pleasure to solve the problem by submitting it to gitlab.

 

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.