为什么我会发生合并冲突? [英] Why I get merge conflict?

查看:91
本文介绍了为什么我会发生合并冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将更改保存到存储中.添加一些代码.提交.

I save my changes into stash. Add some code. Commit.

当我尝试应用隐藏的更改时,出现合并冲突:

When I try to apply stashed changed I get merge conflict:

@@@ -847,45 -846,6 +855,53 @@@ do $$ begin RAISE NOTICE 'Move time: 20
  set local my.sys_time to '2018-08-23';

  do $$ begin
++<<<<<<< Updated upstream
 +do $$ begin RAISE NOTICE 'Move time: 2018-08-23'; end $$ language 'plpgsql';
 +set local my.sys_time to '2018-08-23';
 +
 +do $$ begin
 +--TODO: Test UPDATE when NEW.app_period is same as OLD.app_period
 +-- and NEW.app_period is intersect app_period() for some rows
 +--As update behavior should be same for rows where NEW and OLD
 +-- as different as equal (see next test after this one)
++||||||| merged common ancestors
++--TODO: Test UPDATE when NEW.app_period is same as OLD.app_period
++-- and NEW.app_period is intersect app_period() for some rows
++--As update behavior should be same for rows where NEW and OLD
++-- as different as equal (see next test after this one)
++=======
++>>>>>>> Stashed changes
  RAISE NOTICE 'Test UPDATE app_period by 2018-08-17 .. 2018-08-24, when applicatoin perio
    USING HINT =  'Row just updated. Nothing special should happen';
  end $$ language 'plpgsql';

但是为什么呢?隐藏的更改不会对发生冲突的commented TODO行增加任何作用.

But why? Stashed changes adds nothing to that commented TODO lines where conflict occur.

推荐答案

Git不会默默地假设两个紧邻的文本块是不相关的,因为它们经常是相关的.在另一个合并中,您添加的块将是描述已移至其他位置或已排除的功能的注释.

Git doesn't silently assume two immediately adjacent blocks of text are unrelated because they often are related. In another merge your added block would be comments describing a function that was moved elsewhere or factored out.

这篇关于为什么我会发生合并冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆