通过 git log 查看修改了哪些文件,去除重复(排重)

 
更多

通过 git log 查看修改了哪些文件,重复的文件仅显示一行(排重)。

git log --author=phpernote.com --stat | grep -E '\+|\-' | grep '.php'

得到类似下面的内容列表:

common/components/workflow/WorkflowManagers.php                     | 2 +-
 …/controllers/WfFormAccountingController.php     | 35 +++++++++++———–
 …/controllers/WfFormAccountingController.php     |  5 ++–
 common/models/workflow/WfFormAccounting.php        | 28 +++++++++————-
 common/models/workflow/WfFormAccounting.php | 7 +——
 …/workflow/audit/WfAccountingAudit.php           | 164 ++++++++++++———
 …/controllers/WfFormAccountingController.php     | 173 +++++++++++
 …/workflow/audit/WfAccountingAudit.php           | 323 +++++++++++++++++++++
 common/enums/workflow/WfAccountingEnum.php         |  43 +++
 common/models/workflow/WfAccountingFiles.php       | 181 ++++++++++++
 common/models/workflow/WfFormAccounting.php        | 105 +++++++
 common/enums/WorkflowTypeEnum.php | 4 ++++
 common/models/workflow/WorkflowType.php | 4 ++–

然后在 phpstorm 通过如下正则清除前面的空格和 .php 后面的字符:

^\s+ #清除行首的空格
.php.+ #将匹配的内容替换为 .php

然后参考

linux 删除文件相同的行

将重复的文件处理只留下一行即可。

因为公司这个需求比较频繁,因此认真研究了下,总结了一个更为可靠的命令如下

git log --author=phpernote.com --stat --no-merges --name-only |grep ".php$" | sort | uniq

参考了文章:

git log命令参数详解

linux 删除文件相同的行

打赏

本文固定链接: https://www.cxy163.net/archives/3025 | 绝缘体

该日志由 绝缘体.. 于 2023年12月24日 发表在 未分类 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: 通过 git log 查看修改了哪些文件,去除重复(排重) | 绝缘体
关键字: , , , ,

通过 git log 查看修改了哪些文件,去除重复(排重):等您坐沙发呢!

发表评论


快捷键:Ctrl+Enter