Git prompts "Pull is not possible because you have unmerged files." solution

Source: Internet
Author: User

In the git pull process, if there is a conflict, all files except conflicting files will be saved as staged files.

Reproduction:

$ Git pull

A Applications/Commerce/BookingAnalysis. java
A Applications/Commerce/ClickSummaryFormatter. java
M Applications/performanceforecasting/forecast/Forecast. java
A Applications/performanceforecasting/forecast/ForecastCurveProviderCategory. java
M Applications/performanceforecasting/forecast/ForecastProvider. java
M Applications/performanceforecasting/forecast/InputPropertyItem. java
......

A Applications/LocalezeImporter/com/tripadvisor/feeds/SingleMenuLocalezeMatcher. java
A Applications/LocalezeImporter/com/tripadvisor/feeds/TypeCategory. java

Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'Git add/rm <file>'
As appropriate to mark resolution, or use 'Git commit-'.

Through git status, you will find the following odd things:

Zhonghua @ pts/ttys000 $ git status
# On branch sns
# Your branch and 'snsconnect/sns 'have diverged,
# And have 1 and 52 different commit (s) each, respectively.
#
# Changes to be committed:
#
# New file: src/config/features_daodao.ini
# New file: src/config/services. xml
# New file: src/config/svnroot/hooks/mailer. conf
# New file: src/config/svnroot/hooks/mailer. py
# New file: src/config/svnroot/hooks/post-commit
# New file: src/config/svnroot/hooks/pre-commit
# New file: src/config/svnroot/hooks/prerelease_icationications.py
# New file: src/config/svnroot/hooks/run_checks.py
.......

# Untracked files:
# (Use "git add <file>..." to include in what will be committed)
#
# _ Build/
# Css/combined/
# Css/gen/
# Daodao-site.patch
# Daodao-site.patch1
# Js/combined/
# Js/gen/
# Lib/weibo/
# Src/bin/

Pull is not possible because you have unmerged files.

Solution:

1. pull will use git merge to cause a conflict. You need to resolve the conflicting file to git add-u. After git commit, pull can be successful.

2. If you want to discard local file modifications, you can use

Git reset -- hard FETCH_HEAD

FETCH_HEAD indicates the commit point formed after the previous successful git pull. Then git pull.
Note:

Git merge will form a MERGE-HEAD (FETCH-HEAD ). Git push will form a reference like HEAD. HEAD indicates the reference generated after the local push is successful recently.

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.