jugal
jugal

Reputation: 279

Get the project which has been modified in a git repository

so i m trying to create a pipeline for continuous delivery in Jenkins. My first step is to import the git repository to my Jenkins server. To give an idea my git repository is hosted on a bitbucket server ( for eg testrepository.git). Now within this repository the structure is as follows

Testrepository.git

My aim is to get the list of projects which have been modified and build only those in my pipeline. Is there a way to achieve this ? All the projects are java projects with gradle build file

Upvotes: 2

Views: 312

Answers (1)

gzh
gzh

Reputation: 3596

git log --name-only will show you the filename list modified in each commit. you can analyse filename list to judge which project was modified.

If you do continuous delivery, you can get modified file list from last delivery by the following command, suppose "2016-11-10 16:00" is your last delivery timestamp.

git diff $(git rev-list -n 1 --before="2016-11-10 16:00" HEAD) --name-only

Upvotes: 3

Related Questions