【发布时间】:2017-09-25 11:28:55
【问题描述】:
我正在使用 php-git 客户端在我的 php 脚本中拉取分支。 每当我从 master 结帐到 testing 时,我都会收到以下错误。
error: Pull 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.
我的文件在 bitbucket 服务器上。我在 bitbucket 上添加/修改文件并在那里提交。
我不明白,我没有在本地机器上修改任何东西,但我仍然收到此错误。
以下是我的“git status”输出。
Your branch is up-to-date with 'origin/testing'.
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Changes to be committed:
modified: g_1.0.yaml
new file: potter_3.4.yaml
new file: potter_3.4.yml
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: abc_1.0.json
【问题讨论】:
-
在该文件夹/目录中运行
git status。 -
Exiting because of an unresolved conflict... 错误信息再清楚不过了。输入git status以查看您的哪些文件仍然存在冲突。 -
添加了我的 git 状态输出,我的问题是如果我没有在本地修改任何内容,所有内容都在服务器上进行了修改,为什么会出现此错误?
-
您已经清楚地更改了文件 G_1.0.yaml 中的某些内容,只需运行 git diff "g_1.0.yaml" 即可查看您的更改。
-
无论您是否在本地进行了修改,您都运行了
git merge(可能是通过运行git pull)并遇到了合并冲突。我总是建议那些刚接触 Git 的人完全避免使用git pull:它只执行两个 Git 命令,如果你自己运行这两个 Git 命令会更好,这样你就可以知道其中一个何时出错(哪个是过去某个时候发生的事情,现在给你留下了这个烂摊子)。