提交代码时发现已经 git merge了,执行提交操作却报:error: Committing is not possible because you have unmerged files ( 错误:由于未合并文件,无法提交文件。).
lifeng@zx-047 MINGW64 /f/project_gitee/Test (master|MERGING)
$ git commit -m'文件整合合并'
error: Committing is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
U djangoProject/hello_django/hello_django/asgi.py
U djangoProject/hello_django/hello_django/settings.py
U djangoProject/hello_django/hello_django/urls.py
U djangoProject/hello_django/hello_django/wsgi.py
U djangoProject/hello_django/manage.py
解决方案如下:
- 首先 git status 查看下哪些没合并
lifeng@zx-047 MINGW64 /f/project_gitee/Test (master|MERGING)
$ git status
On branch master
Your branch is up to date with 'origin/master'.
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Changes to be committed:
new file: djangoProject/hello_django/hello_apps/__init__.py
new file: djangoProject/hello_django/hello_apps/admin.py
new file: djangoProject/hello_django/hello_apps/apps.py
new file: djangoProject/hello_django/hello_apps/migrations/__init__.py
new file: djangoProject/hello_django/hello_apps/models.py
new file: djangoProject/hello_django/hello_apps/tests.py
new file: djangoProject/hello_django/hello_apps/views.py
new file: djangoProject/hello_django/hello_django/__init__.py
new file: "document/testSpecification/\344\272\247\345\223\201\346\265\213\350\257\225\350\247\204\350\214\203.xlsx"
new file: document/testUseCaseDefectLibrary/case_library.md
new file: document/testUseCaseDefectLibrary/defects_library.md
new file: document/testUseCaseDefectLibrary/flowchart_template.md
new file: performance/locustProject/common/__init__.py
new file: performance/locustProject/common/auth.py
new file: performance/locustProject/common/config.py
new file: performance/locustProject/locustfile.py
new file: performance/locustProject/requirements.txt
new file: requirements.txt
Unmerged paths:
(use "git add <file>..." to mark resolution)
added by them: djangoProject/hello_django/hello_django/asgi.py
added by them: djangoProject/hello_django/hello_django/settings.py
added by them: djangoProject/hello_django/hello_django/urls.py
added by them: djangoProject/hello_django/hello_django/wsgi.py
added by them: djangoProject/hello_django/manage.py
- 其次执行下 git add 从新添加下;其次再 git commit -m' 注释信息 ';最后再 git push
lifeng@zx-047 MINGW64 /f/project_gitee/Test (master|MERGING)
$ git add *
The following paths are ignored by one of your .gitignore files:
venv
hint: Use -f if you really want to add them.
hint: Turn this message off by running
hint: "git config advice.addIgnoredFile false"
lifeng@zx-047 MINGW64 /f/project_gitee/Test (master|MERGING)
$ git commit -m'解决冲突文件'
[master 50712fc] 解决冲突文件
lifeng@zx-047 MINGW64 /f/project_gitee/Test (master)
$ git push origin master
Enumerating objects: 1, done.
Counting objects: 100% (1/1), done.
Writing objects: 100% (1/1), 248 bytes | 248.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-5.0]
To gitee.com:lifeng0402/Test.git
6673675..50712fc master -> master
以上总结或许能帮助到你,或许帮助不到你,但还是希望能帮助到你,如有疑问、歧义,评论区留言会及时修正发布,谢谢!
未完,待续…
一直都在努力,希望您也是!