如何在 git 中找出完整的 jenkins 构建而不是特定提交的所有更改文件的列表? [英] how to find out list of all changed files in git for full jenkins build and not for a particular commit?

查看:16
本文介绍了如何在 git 中找出完整的 jenkins 构建而不是特定提交的所有更改文件的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 GIT 中查找自上次提交构建以来所有更改的文件?我想不仅要构建在头部修订时更改的文件,还要构建自上次成功构建以来在此之前更改的所有更改文件.

How to find all changed files since last commited build in GIT ? I want to build not only the changed files at head revision but also, all the changed files which got changed before that as well since last successful build.

git show --pretty="format:" --name-only 将仅对顶部提交更改的文件进行构建.像这样,我需要为自上次成功构建以来不同提交中的所有更改文件构建.

git show --pretty="format:" --name-only will do the build only for top commit changed files. Like this, i need to build for all changed files in different commits since last successful build.

比如,最后一次构建是在 Jenkins 中以 X SHA-1 id 完成的,在那之后,还有 3 次提交.所以,我的目标是检查整个存储库代码库直到 head,然后找出在 X SHA-1 id 之后更改的所有文件的列表,即在 X SHA-1 id 的最后一次提交之上的 3 次提交?

Like , last build done in Jenkins at X SHA-1 id, and after that , there are 3 more commits on top of it. So, my aim is to checkout whole repository codebase till head and then find out list of all files which got changed after X SHA-1 id , that are 3 commits on top of last commit at X SHA-1 id ?

谢谢

推荐答案

聚会有点晚,但更好的方法是在 git diff 上使用 --name-only 功能.我用的如下:

Little late to the party but a slightly better way is to use the --name-only functionality on git diff. What I used is as follows:

git diff --name-only $GIT_PREVIOUS_COMMIT $GIT_COMMIT

这样你以后就不必做一些管道工作了.

This way you don't have to do some piping work afterward.

这篇关于如何在 git 中找出完整的 jenkins 构建而不是特定提交的所有更改文件的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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