Git 基础 - 冲突解决
作者:互联网
- 从本地master分支创建dev分支
- 从本地master分支创建dev1分支
- 在dev分支修改 READM.md 文件,并添加到暂存区
- 在dev1分支修改 READM.md 文件,并添加到暂存区
[@wooluwalkerdeMacBook-Pro:wenjian (dev)]$ git ci -m'dev修改READM.md' #dev分支的修改提交 [@wooluwalkerdeMacBook-Pro:wenjian (dev1)]$ git ci -m'dev修改README.md' #dev1分支的修改提交 [@wooluwalkerdeMacBook-Pro:wenjian (dev1)]$ git merge dev #将本地dev分支合并到本地dev1分支,产生了冲突 Auto-merging README.md CONFLICT (content): Merge conflict in README.md Automatic merge failed; fix conflicts and then commit the result. [@wooluwalkerdeMacBook-Pro:wenjian (dev1)]$ cat README.md # 冲突文件,等号上方为当前分支dev1内容,下方为被合并分支dev的内容 <<<<<<< HEAD dev1修改的内容 ======= dev修改的内容 >>>>>>> dev [@wooluwalkerdeMacBook-Pro:wenjian (dev1)]$ vim README.md # 编辑冲突文件 [@wooluwalkerdeMacBook-Pro:wenjian (dev1)]$ cat README.md # 编辑后的冲突内容 dev修改的内容 [@wooluwalkerdeMacBook-Pro:wenjian (dev1)]$ git ci -m'解决dev和dev1的README.txt合并冲突' [dev1 fb7abce] 解决dev和dev1的README.txt合并冲突 [@wooluwalkerdeMacBook-Pro:wenjian (dev1)]$ git dog * fb7abce (HEAD -> dev1) 解决dev和dev1的README.txt合并冲突 |\ | * fab7157 (dev) dev修改READM.md * | 9e782b0 dev修改README.md |/ * 217fef2 (origin/master, origin/HEAD, master) Update README.md,添加日期 * a565481 (origin/dev) Update README.md * 19cfeea 第一次将远程dev分支代码合并到master分支Merge branch 'dev' |\ | * b1777d8 commit merge_excel_utils | * ee37473 manage utils | * 0b6e16c commit files * | 441940f 添加项目说明 |/ * 0f1f9d7 Initial Commit
# 即可将dev1或dev push到远程
标签:md,Git,wenjian,dev,README,dev1,冲突,解决,分支 来源: https://www.cnblogs.com/wooluwalker/p/12253226.html