Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过cherry picking在添加的文件上运行git diff_Git_Groovy - Fatal编程技术网

通过cherry picking在添加的文件上运行git diff

通过cherry picking在添加的文件上运行git diff,git,groovy,Git,Groovy,我有一个groovy脚本,它根据git日志和git diff构建报告。报告的目的是在发布构建之前审查pom文件中的任何第三方插件,因此报告100%准确是非常关键的。脚本基本上接受一次提交并检索自提交以来所有修改过的文件,对于每个文件,我运行git diff以获取添加和删除的行 由于某种原因,cherry picking添加的一个pom文件在我对其执行git diff时没有显示任何内容 我用于获取文件名及其状态的命令是: 然后我运行此命令以获取差异: 您可以这样做: git diff --name

我有一个groovy脚本,它根据git日志和git diff构建报告。报告的目的是在发布构建之前审查pom文件中的任何第三方插件,因此报告100%准确是非常关键的。脚本基本上接受一次提交并检索自提交以来所有修改过的文件,对于每个文件,我运行git diff以获取添加和删除的行

由于某种原因,cherry picking添加的一个pom文件在我对其执行git diff时没有显示任何内容

我用于获取文件名及其状态的命令是:

然后我运行此命令以获取差异:

您可以这样做:

git diff --name-only <sha of the starting commit> <sha of the commit you want to compare the starting commit with>

我希望这能有所帮助。

对不起,我相信错误是我自己造成的。我在命令中使用了错误的commitSHA。不过我很感激你的回答
git checkout ${branch}&git diff --unified=0 --color=never ${lastRevs[i]} ${fileName}
git diff --name-only <sha of the starting commit> <sha of the commit you want to compare the starting commit with>