git合并冲突

git合并冲突

问题描述
复制代码
Auto-merging mes5server/mes5j.json
Auto-merging mes5server/mes5j.json
CONFLICT (content): Merge conflict in mes5server/mes5j.json
Automatic merge failed; fix conflicts and then commit the result.
原因

要合并的两个分支改动了同一份文件。

解决方法
  • 1.查看冲突文件

    git status

  • 2.查看冲突文件,=======上面是当前分支的代码,=======下面是要合并进来的分支代码,两者发生了冲突

    <<<<<<< HEAD
    你的本地代码

    从远程拉取的代码

    origin/master

  • 3.编辑冲突文件,决定保留哪些更改,然后删除冲突标记。

  • 4.标记文件为已解决冲突状态

复制代码
git add <file-with-conflict>
  • 5.解决冲突后提交修改

    git commit -m "提交信息"

  • 6.再次尝试拉取

    git pull origin master

将远程origin主机的master分支拉取过来和本地的当前分支进行合并

相关推荐
一允14 小时前
Git学习记录
git·学习
程序员果子15 小时前
GraphRAG:让大模型在知识图谱中精准导航
人工智能·git·语言模型·aigc·知识图谱
later_rql18 小时前
【Git提交remote rejected】
git
Tatalaluola20 小时前
Git版本控制常用命令
git
我有酒两杯21 小时前
记录一次git使用
git
caz2821 小时前
git bash突然ssh不能用了
git·ssh·bash
Remember_9931 天前
【JavaSE】一站式掌握Java面向对象编程:从类与对象到继承、多态、抽象与接口
java·开发语言·数据结构·ide·git·leetcode·eclipse
移远通信1 天前
短信的应用
java·git·python
论迹1 天前
【Git】-- 分支管理
git·ubuntu·版本控制
在下小孙1 天前
Git与SVN常用指令
git·svn