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.