git在几次提交中列出了更改的文件 [英] git list changed files in several commits

查看:74
本文介绍了git在几次提交中列出了更改的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取在符合某些条件的提交中更改的所有文件.所以我有以下内容:git log --grep=123,并且我需要获取在提交中更改的文件作为聚合列表,例如如果文件在多次提交中被更改,则应仅在结果列表中包含一次.就像在Torvise svn日志窗口中选择多个提交一样,它列出了在选定提交中更改的所有文件

I want to get all files that are changed in commits that matched some conditions. So I have following: git log --grep=123, and I need to get files that are changed in that commits as an aggregated list, e.g. if file is changed in several commits it should be included only once in the resulting list. That is like selecting several commits in tortoise svn log window, it lists all files that are changed in the selected commits

推荐答案

git log不应用于编写脚本,但这是一种快速解决方案:

git log shouldn't be used for scripting, but here's a quick solution:

git log --grep=pattern --name-only --pretty=format:'' | sort -u

这篇关于git在几次提交中列出了更改的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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