git diff 忽略文件中的模式

发布于 2024-10-08 15:31:18 字数 808 浏览 5 评论 0原文

我的 git diff 有问题。首先让我向您介绍一下历史。

我刚刚从客户那里得到了一个相当不受欢迎的项目。问题是他们的 SCM 中有两个分支。这两个分支已经很久没有合并了,但现在必须合并了。大多数更改都是微不足道的,因此通过 Git 合并只需要大约 30 分钟。

但是,我的客户不相信合并过程可以自动化。因此,他们希望通过一个包含正在运行的所有四个版本的代码(基础和版本 a、基础和版本 b、a 和 b 等)之间差异的差异列表来审查合并。

这也是一件很微不足道的事情,但问题来了。由于这两个分支之间存在很多变化,因此 diff 列表非常长(每个大约 50 MB),因此这些列表是无用的。现在我的客户希望将更改分组。

这些“分组差异”中有四个主要组。我想让 git diff 能够忽略当时的各个组。

g1:有很多斜线改变了方向。因此我希望 Git 能够以同样的方式解释 /\ 。我已经找到了如何让 Git 忽略包含斜杠的整行,但这不是我想要的,因为路径(斜杠来自的位置)可能已更改。

g2:这个问题在结构上非常类似于上面的问题,除了我涉及更多的符号。日志记录中有很多格式已更改。主要与丹麦字母相关,“æ”已更改为“&” aelig;', 'ø' 已更改为 '& oslash;' 等

g3:很多评论已更改。客户担心某些'*/'可能没有被合并。我如何验证这一点?

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

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 two branches in their SCM. These two branches have not been merged for ages, but now they have to merge them. Most of the changes are trivial, so merging via Git only takes about 30 minutes.

However, 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 four versions 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 are many changes between these two branches, the diff lists are very long (about 50 MB each), and therefore the lists are useless. Now my customer wants to have the changes grouped.

There are four 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 structurally very much like the above, except from I have more symbols involved. There are lots of formatting 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 have been changed. The customers is worried that some '*/' might not has been merged. How can I verify this.?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

恍梦境° 2024-10-15 15:31:18

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

不知道如何处理 g3。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文