Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to find out list of all changed files in git for full jenkins build and not for a particular commit?

Tags:

git

jenkins

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 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.

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 ?

Thanks

like image 919
user2571169 Avatar asked Jul 31 '13 19:07

user2571169


People also ask

Which Jenkins command to get the list of changed files?

You can use the changeSets property of the currentBuild global variable to get information relating to the detected changes of the current build.

How do you find a list of files that have been changed in a particular commit write your answer here?

Find what file changed in a commit To find out which files changed in a given commit, use the git log --raw command.

How do you check the changes in git before commit?

If you just want to see the diff without committing, use git diff to see unstaged changes, git diff --cached to see changes staged for commit, or git diff HEAD to see both staged and unstaged changes in your working tree.


1 Answers

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.

like image 116
ford prefect Avatar answered Oct 28 '22 13:10

ford prefect