使用 git 上传文件时,运行 命令 git pull origin 时未成功,出现报错信息

项目场景:

背景:

使用 git 上传文件时,运行 命令 git pull origin 时未成功,出现报错信息


问题描述

问题:

$ git pull origin print --allow-unrelated-histories
error: Pulling is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm '
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.


使用 git 上传文件时,运行 命令 git pull origin 时未成功,出现报错信息_第1张图片


原因分析:

分析:

在这里插入图片描述


解决方案:

解决方案:
根据错误信息的提示,我们可以了解到,是有文件存在冲突,所以我们首先需要:

一、将本地的冲突文件冲掉,不仅需要 reset 到 MERGE-HEAD 或者 HEAD, 还需要–hard。
因为没有后面的hard,不会冲掉本地工作区。只会冲掉stage区。

命令: git reset --hard FETCH_HEAD
在这里插入图片描述
二、add文件

命令: git add .

三、查看状态

命令:git status

四、重新提交文件

命令: git commit -m “new version”

五、从将本地的分支版本上传到远程并合并
git push

六、从远程获取 最新版本并 merge 到本地
git pull

示例: git pull origin master

七、git fetch 和 git pull 的区别:

git fetch:相当于是从远程获取最新版本到本地,不会自动合并。
git pull:相当于是从远程获取最新版本并 merge 到本地。

你可能感兴趣的:(git,elasticsearch,大数据)