Rails使用<<<<<<<<< HEAD" [英] Rails messing up my code with "<<<<<<< HEAD"

查看:95
本文介绍了Rails使用<<<<<<<<< HEAD"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我发现rails或其他实体通过将<<<<<<<<<<<<<<<<<<<<<<<<<<<<这是一个例子:

 类ExampleController 
def foo
bar = 1
<<<<<< HEAD
if bar == 1
putsbar is one
else
putsbar is not one
end
===== ==
if bar == 2
putsbar is two
else
putsbar is not two
end
>> >>>>> 17fb60436a4de2e0 ...
end
end

任何人都知道为什么它的行为如此

解决方案

是的,你或其他人正在使用GIT来版本控制这些源代码,这很好。



现在您必须知道如何解决冲突!

如何解决Git中的合并冲突? 如果你是使用git的人,拉代码时请小心。如果在某处发生冲突,请停止!然后使用 git mergetool 或者浏览CONFLICT所涉及的每个文件的列表并手工编辑它们。

冲突的代码用<<<<<<< c $ c>来标记,< code> ======== >>>>>>> 。你必须将它合并

I recently discovered that rails or some other entity is messing up my code by putting "<<<<<<< HEAD" all over the place. This is an example of what it looks like:

Class ExampleController
  def foo
    bar = 1
<<<<<<< HEAD
    if bar == 1
      puts "bar is one"   
    else
      puts "bar is not one"
    end
=======
  if bar == 2
    puts "bar is two"
  else
    puts "bar is not two"
  end
>>>>>>> 17fb60436a4de2e0...
  end
end

Anyone know why its behaving like this?

解决方案

Yep, you or someone else is using GIT to version-control these sources, which is good.

Now you have to know how to resolve conflicts!

How to resolve merge conflicts in Git?

If you are the one using git, please be careful when pulling code. If there's CONFLICT written somewhere, STOP! Then use git mergetool or go through the list of each file concerned by a CONFLICT and edit them by hand.

Conflicting code is marked with <<<<<<, ======== and >>>>>>>. You have to merge it

这篇关于Rails使用&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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