通过 git log 查看修改了哪些文件,重复的文件仅显示一行(排重)。
git log --author=maopiaopiao.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=maopiaopiao.com --stat --no-merges --name-only |grep ".php$" | sort | uniq
参考了文章:
git log命令参数详解
linux 删除文件相同的行