git merge 不同分支合并时,同一文件名的内容不同产生冲突

同一项目有三个分支,将second分支合并到first分支上

git merge 冲突解决

first分支的hello.txt文件内容

  git merge 冲突解决

second分支的hello.txt文件内容

  git merge 冲突解决

 

git merge 合并(当前分支是first分支)

  git merge second

  git merge 冲突解决

  "Merge conflict in hello.txt"说明在hello.txt文件产生合并冲突

  分支名由(first)变成(first|MERGING)说明产生冲突

  在编辑器打开冲突的文件:helle.txt文件

  git merge 冲突解决

解决合并冲突 

  第一步:在<<<<<<< <分支名>   ========   >>>>>>>><分支名> 删掉,冲突代码自行合并修改

  第二部:git add <已修改冲突文件>

    git merge 冲突解决

  第三部:git commit -m "合并日志"

    git merge 冲突解决

    注意:这里commit提交时不能带上文件

    分支名由(first|MERGING)变成(first)说明合并成功

相关文章:

  • 2021-06-02
  • 2022-12-23
  • 2022-01-09
  • 2022-01-16
  • 2022-12-23
  • 2021-08-14
  • 2021-08-24
  • 2022-01-14
猜你喜欢
  • 2022-12-23
  • 2021-08-19
  • 2021-06-19
  • 2021-08-06
  • 2021-10-08
  • 2022-12-23
  • 2021-10-04
相关资源
相似解决方案