Our project is working within fairly close quarters code-wise (a lot of changes happening in parallel in a fairly small geographical area of the code), and our feature branch based git workflow works out really nice for our java code.

我们的项目在代码上非常接近的范围内工作(在代码的很小的地理区域内并行地发生了许多更改),我们基于git的特性分支对于我们的java代码来说非常好。

But the xml/html stuff is not working really well. Simple unrelated changes (a designer adding a surrounding div, a developer changing an id of an element within) gives really disasterous merges.

但是xml/html并没有很好地工作。简单的不相关的更改(一个设计人员添加了一个周围的div,一个开发人员改变了一个元素的id)给了真正的不稳定的合并。

I realize there may be several options on how to handle this. A good git xml merge would be optimal, or putting restrictions on reformatting of xml/html code another. Not working in such close quarters would be another (unacceptable) option.

我知道如何处理这个问题可能有几个选择。一个好的git xml合并将是最优的,或者限制xml/html代码的重新格式化。在这样的近距离工作将是另一个(不可接受的)选择。

How do you solve this problem efficiently ?

如何有效地解决这个问题?

2 个解决方案

#1


18

Git allows for custom merge drivers, selected via gitattributes per path (e.g. for all *.xml files).

Git允许自定义合并驱动程序,通过每个路径的git属性选择(例如对于所有*)。xml文件)。

What you need to find is a XML-aware merge driver, plus possibly also write a simple script to transform between Git conventions and said merge driver conventions. There is for example XML::Merge Perl module. There is XyDiff, but it looks like it lacks three-way merge (and I guess that for XML building 3-way merge from diffs like described in A Formal Investigation of Diff3 paper (PDF) wouldn't work). You can also read Matching, diffing and merging XML blog post (or article referenced therein).

您需要找到的是一个支持xml的合并驱动程序,另外还可能编写一个简单的脚本,以便在Git约定和所谓的合并驱动程序约定之间进行转换。例如,XML::Merge Perl模块。有XyDiff,但是看起来它缺少三路合并(而且我猜对于XML构建的三路合并来说,就像对Diff3文件(PDF)的正式调查中所描述的那样,它是行不通的)。您还可以阅读匹配、扩散和合并XML blog post(或其中引用的文章)。

Another solution would be to unset merge attribute for XML files (they would be treated like binary files wrt. merge conflicts), and use some graphical merge tool to resolve merge conflicts, perhaps via git mergetool.

另一种解决方案是为XML文件取消设置合并属性(它们将像二进制文件wrt一样处理)。合并冲突),并使用一些图形合并工具来解决合并冲突,可能是通过git mergetool。

更多相关文章

  1. 我无法理解为什么我的代码中的单击选择文本
  2. js字符串与html代码互相转换时怪想法:自己解析js字符串成普通字
  3. 解决FCKEditor编辑器在浏览器返回时显示html源代码的问题
  4. 高分求:如何解析IdHTTP获得的http代码?用mshttp的IHTMLDocument2可
  5. 韩顺平_轻松搞定网页设计(html+css+javascript)_第19讲_js运行原
  6. HTML显示日期时间代码 - [js 特效代码]
  7. 解决html代码中插入的图片在浏览器中不显示的办法
  8. HTML代码格式化工具
  9. j2ee的web项目,有最终的html代码(即f12看到的最终给用户浏览器展示

随机推荐

  1. RelativeLayout 常用XML 属性
  2. android Wifi自动连接
  3. Android使用ViewFlipper做页面切换,与手势
  4. Android发展史
  5. 写一个没有Activity的 HelloWorld for an
  6. 通过xml加载菜单Menus
  7. Android图形系统分析与移植--五、Android
  8. android设置在ListView中让TextView滚动
  9. Android 源代码结构
  10. android 电容屏(一):电容屏基本原理篇