[Solved] Pull is not possible because you have unmerged files

Pull is not possible because you have unmerged files.

During git pull, if there is a conflict, then all the files except the conflicting ones are saved as files in the staged area.

Reproduction.

$ git pull

A Applications/Commerce/BookingAnalysis.java
A Applications/Commerce/ClickSummaryFormatter.java
M Applications/CommerceForecasting/forecast/Forecast.java
A Applications/CommerceForecasting/forecast/ForecastCurveProviderCategory.java
M Applications/CommerceForecasting/forecast/ForecastProvider.java
M Applications/CommerceForecasting/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 -a’.

With git status you will find the following oddities.

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_notifications.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 files git add -u, git commit before you can successfully pull.

2. If you want to abandon the local file changes, you can use git reset –hard FETCH_HEAD, FETCH_HEAD means the commit point formed after the last successful git pull. Then git pull.
Note that.

git merge will form MERGE-HEAD (FETCH-HEAD). git push will form a reference like HEAD. HEAD represents the local reference formed after the most recent successful push.

Translated with www.DeepL.com/Translator (free version)

Similar Posts: