如何根据文件扩展名过滤git diff? [英] How to filter git diff based on file extensions?

查看:146
本文介绍了如何根据文件扩展名过滤git diff?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将git diff限制为给定的一组文件扩展名?

Is there an option to restrict git diff to a given set of file extensions?

推荐答案

是的,如果您确保git扩展了一个glob而不是您的shell,那么它将在任何级别上都匹配,因此类似这样的内容(引号很重要)应该可以正常工作

Yes, if you ensure that git expands a glob rather than your shell then it will match at any level so something like this (quotes are important) should work fine.

git diff -- '*.c' '*.h'

这篇关于如何根据文件扩展名过滤git diff?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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