git:我可以在不编辑文件的情况下接受合并冲突中的两个更改吗? [英] git: can I accept both changes in a merge conflict without editing files?

查看:107
本文介绍了git:我可以在不编辑文件的情况下接受合并冲突中的两个更改吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常在Rails区域设置文件上存在合并冲突,例如:

I usually have merge conflicts on Rails locale files, for example:

<<<<<<< HEAD
  label_company_offices: "Branches"
=======
  field_amounts_withheld: "Withheld amount"
>>>>>>> master

在这里我必须编辑每个区域设置文件,我可以避免这种情况吗?

here I have to edit every locale file, can I avoid this?

有什么办法告诉git解决冲突,接受两个更改"?

there's any way to tell git "resolve conflict accepting both changes"?

推荐答案

这对我有用:

ruby -pi -e "gsub(/^[=<>*]{7}.*\n/,'')" config/locales/*.yml

这篇关于git:我可以在不编辑文件的情况下接受合并冲突中的两个更改吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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