显示匹配特定模式的哪些文件在git分支之间已更改 [英] Showing which files that match a specific pattern have changed between git branches

查看:55
本文介绍了显示匹配特定模式的哪些文件在git分支之间已更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想合并两个分支,但是在此之前,我想查看文件名以 .twig 结尾的所有文件在两个分支之间的更改.

I want to merge two branches but before, I'd like to review the changes between the two branches on all files whose filename ends with .twig.

是否有可能,还是应该使用bash魔术般的 git diff --name-only branch1..branch2 |grep .twig 吗?

Is it possible, or should I use some bash-magic like git diff --name-only branch1..branch2 | grep .twig ?

推荐答案

您可以在-之后将文件名传递给git diff,因此:

You can pass the file names to git diff after a --, so:

git diff-仅名称的branch1..branch2-'* .twig'

git diff --name-only branch1..branch2 -- '*.twig'

应该做你想做的.我将* .twig放在单引号中,以使外壳程序不会对其进行扩展.

Should do what you want. I put *.twig in single quotes so the shell won't expand it.

这篇关于显示匹配特定模式的哪些文件在git分支之间已更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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