列出提交和在提交下更改的文件

List commits and files changed under commit

我想知道是否有办法查看提交信息使用grep时提交中更改的文件。

在我使用的提交消息中搜索字符串时检索提交:

git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --grep=<SEARCHING_STRING>

然后我获取提交 ID 并使用以下命令获取提交下更改的所有文件:

git log --oneline --name-only | grep -Eo "\w/.*\.\w+" | sort -u --grep=<COMMIT_ID>

我正在尝试创建一个 bash 脚本来将这两个命令合并为一个,并在没有成功的情况下检索提交和提交下的所有文件。

使用--name-status标志。喜欢:

git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --name-status --grep=<SEARCHING_STRING>