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分支拉取过来和本地的当前分支进行合并

相关推荐
CodexDave11 小时前
数据库连接池耗尽:排查顺序与三层兜底
服务器·前端·数据库·git·云原生·容器·kubernetes
乐观的Terry12 小时前
5、发布系统-Git 集成
大数据·git·elasticsearch
不怕犯错,就怕不做13 小时前
GIT的简单打patch应用format-patch and git am
linux·git·全文检索
Byron Loong13 小时前
【Git】如何检查 Ubuntu 系统上 gitLab 是否开启
git·ubuntu·gitlab
lar_slw14 小时前
git删除上一次提交
git
leoZ2311 天前
Git 集成实战完全指南(四):Git 冲突解决
大数据·git·elasticsearch
枫荷1 天前
Git LFS 大文件优化说明
git
techdashen2 天前
不用再反复 stash:用 Git Worktree 同时开发多个分支
大数据·git·elasticsearch
leoZ2312 天前
Git 集成实战完全指南(八):团队协作最佳实践
git
晴雨天️2 天前
Git工具使用指南
笔记·git