繁体   English   中英

由于未合并的文件,Git pull 不可能

[英]Git pull not possible because of unmerged files

我刚刚尝试用另一个分支替换我服务器上的master分支,因为master分支已损坏,我似乎无法解决错误......

我替换它的分支是我拥有的最后一个工作版本。 我通过在本地机器上运行以下命令来做到这一点:

git checkout lastWorkingBranch

git merge -s 我们的主人

git结账大师

git 合并 lastWorkingBranch master

git push 起源大师

然后,在服务器上,我跑了

git pull 起源大师

但是,这给出了以下输出:

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'.
root@moon:/code/moon# git stash
costing/views.py: needs merge
tools.py: needs merge
costing/views.py: needs merge
tools.py: needs merge
costing/views.py: unmerged (395725168ffab1962655116880b74158de3e1e56)
costing/views.py: unmerged (95ff89d4160135c2ebefd67a0fc1af2f2a0abc74)
costing/views.py: unmerged (902f9ff57c808cefd074f3ea07fb252f9eedb4e2)
tools.py: unmerged (6832dd3197f838a52396381c30ef55069e24411b)
tools.py: unmerged (24e8179f7689ffacdd50407259f3a12b3d3f609a)
tools.py: unmerged (93b3d0baa5f1b75c85120cc2e7cab7dcd949b9a5)
fatal: git-write-tree: error building trees
Cannot save the current index state

我尝试在本地计算机上再次提交和推送,然后在服务器上再次运行pull ,现在收到以下消息:

U costing/views.py U tools.py Pull 是不可能的,因为你有未合并的文件。 请在工作树中修复它们,然后根据需要使用“git add/rm”来标记解决方案,或使用“git commit -a”。 root@moon:/code/moon#

我不明白为什么我会得到这个......? 我已经合并并推送了我的所有文件——如何在工作树中修复它们?

您有一些未合并的文件。 因此,首先commitstash文件。

$ git commit -am <message>          # add and commit
$ git pull origin master            # pull origin

Or,
$ git add .                         
$ git stash                         # remove the files
$ git pull origin master

首先给出 git stash 命令-->你会得到有冲突的文件然后使用 Git 添加文件名并回车然后输入 git pull

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM