git diff忽略文件中的模式 [英] git diff to ignore patterns in files

查看:535
本文介绍了git diff忽略文件中的模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个git diff的问题。让我首先填写你的历史。

我刚刚获得了一个客户相当不受欢迎的项目。问题是他们在scm中有2个分支。这两个分支已经很长时间没有合并过,现在它们必须合并它们。大部分更改都很简单,所以通过git进行合并只需要大约30分钟。

我的客户永远不相信合并过程可以自动化。因此,他们想通过比较所有4版本的代码(基本版本和版本a,基本版本和版本b,a和b等)之间的区别列表来检查合并。

这也是相当微不足道的,但问题来了。由于这些分支之间有很多变化,比较列表非常长(每个大约50Mb),因此这些列表毫无用处。现在我的客户希望将这些更改分组。



这些'分组比较'有4个主要组别。我想让git diff能够在时间上忽略它上面的单个组。

g1:有很多斜线改变了方向。因此,我希望git能够解释和/或类似。我已经发现如何让git忽略整条线,如果它包含一个斜杠,但这不是我想要的,因为路径(斜线来自的地方)可能已经改变了。



g2:除了涉及更多符号外,此问题与上述结构非常相似。在日志中有很多格式已经改变。大部分与丹麦信件有关,即'æ'已被改为'& aelig;','ø'已被更改为'& oslash;'等。



g3:很多评论已被更改。客户担心一些'* /'可能没有被合并。我看不到如何验证这一点。你们中的任何一位专家都有想法吗?



g4:上面没有提到的所有内容。这被认为是真正的变化。

解决方案

您可能可以编写一些能够解析差异并删除或消除其中一些更改的内容。一些正则表达式的魔法可能会帮助你。我认为这是最适用于g1和g2的。



不知道该如何处理g3。


I have a problem with git diff. Let me first fill you in on the history.

I have just been given a rather unpopular project from a customer. The problem is that they have 2 branches in their scm. These two branches have not been merged for ages, nut now they have to merge them. Most of the changes are trivial, so merging via git only takes about 30 minutes.

How ever, my customer do not trust that a merge process can be automated. Therefore they want to review the merge, by having a diff list with differences between all 4 version of the code in play (base and version a, base and version b, a and b, etc).

That is also quite trivial, but here comes the problem. Since there's many changes between these to branches, the diff lists are very long (about 50Mb each), and therefore the lists are useless. Now my customer wants to have the changes grouped.

There are 4 main groups in these 'grouped diffs'. I would like to make git diff able to ignore the individual groups on it the time.

g1: There are lot of slashes that has changed their direction. Therefore I would like git to interpret / and \ alike. I have found out how to make git ignore the entire line, if it contains a slash, but that not what I want, since the path (where the slashes comes from) might have changed.

g2: This problem is structuralvise very much like the above, except from I have more symbols involved. There's lots of formating in the logging that has been changed. Mostly related to danish letters, that be 'æ' has been changed to '& aelig;', 'ø' has been changed to '& oslash;' etc.

g3: Lots of comments has been changed. The customers is worried that some '*/' might not has been merged. I can not see how to verify this. Any of you experts have an idea?

g4: All that are not mentioned above. This is considered to be real changes.

解决方案

You may be able to write something that will parse the diff and remove or excise some of those changes. Some regex magic might help you with that. I see this as most applicable to g1 and g2.

Not sure what to do about g3.

这篇关于git diff忽略文件中的模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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