0 评论

0 收藏

分享

[git相关技术] git 遇到冲突CONFLICT (content): Merge conflict in index.html Automatic merge fai

当遭遇冲突我们会发现会有提示是哪个文件造成冲突,Merge conflict in index.html Automatic merge failed; fix conflicts and then commit the result. 提示就是index.html造成了 冲突,一般来说造成这个问题是由于之前未提交的内容,导致线上分支和本地分支有区别,在这种情况下没有git pull 先行拉取
hint: Updates were rejected because the remote contains work that you do nothint: have locally. This is usually caused by another repository pushing tohint: the same ref. If you want to integrate the remote changes, usehint: 'git pull' before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.
因此在这个问题之前一般伴随这样的问题,提示在git push前 先拉取 git pull,因此你一拉取直接报错
那么我们就打开这个文件
我们会发现和线上分支有区别的部分 会这样提示,我们手动来解决 删掉
<<<<<<< HEAD=======>>>>>>>
这些内容
这时候我们再来 git add index.html 将解决后的文件添加到暂存区
git add +修改的文件名
接下来 继续 git commit -m ‘解决冲突’
git push
不再报错!完美解决!

优雅草论坛2022年8月11日大改,优雅草论坛变回只服务于客户的提问交流论坛,详情查看优雅草8月11日大改,原因详情查优雅草外卖乐关闭

回复

举报 使用道具

全部回复
暂无回帖,快来参与回复吧
yac2025
优雅草的临时工
主题 164
回复 0
粉丝 0