git format-patch X..Y对于特定的作者 [英] git format-patch X..Y for a specific author

查看:117
本文介绍了git format-patch X..Y对于特定的作者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以为范围生成补丁,但仅限于来自特定作者的提交,您使用的方式> git log --author ='bob'

解决方案

是的,这是可能的。



参考 > git format-patch 它接受< revision range>


泛型表达式(请参阅指定修订版本gitrevisions(7)中的
部分)意味着指定范围内的提交。

详情请参阅参考资料但我们只需要这一个:


^!例如HEAD ^!

后缀^后跟感叹号与提交相同,然后其所有父母都以^作为前缀排除它们
(及其它


所以你需要:

  git log X..Y --author ='< AUTHOR>'--format =%H| sed's / $ / ^!/ g'| xargs -I {} git format-patch {} 

git log X. .Y --author ='< AUTHOR>'--format =%H产生的输出格式为40位数的sha1和

sed's / $ / ^!/ g'加上^!在每行的结尾处



xargs -I {} git format-patch {} 只是运行 git format-patch 与每行


I was wondering if you can generate patches for a range but only limit to commits from a specific author, the way you do with git log --author='bob'.

解决方案

Yes, it is possible.

According to reference on git format-patch it accepts <revision range>

Generic expression (see "SPECIFYING REVISIONS" section in gitrevisions(7)) means the commits in the specified range.

Details may be found in the reference but we only need this one:

^!, e.g. HEAD^!

A suffix ^ followed by an exclamation mark is the same as giving commit and then all its parents prefixed with ^ to exclude them (and their ancestors).

So you'll need:

git log X..Y --author='<AUTHOR>' --format="%H" | sed 's/$/^!/g' | xargs -I{} git format-patch {}

git log X..Y --author='<AUTHOR>' --format="%H" produces output in format of 40-digit sha1 sums.

sed 's/$/^!/g' adds ^! at the end of each line

xargs -I{} git format-patch {} just runs git format-patch with each line

这篇关于git format-patch X..Y对于特定的作者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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