Jenkins Git, Get all commits in the last Push in Pull Requests
You can use git log A..B
..
/...
In git those 2 or 3 dots mean range = between (include and exclude).
Most common used withgit cherry-pick <start>..<end>
Steps:
Get the last commit - you have it in Jenkins or grab it in your script before the job starts with
# Get the past SHA1 of the current commitgit log -1 --pretty=%T
Once the script finish execute the diff command
# Get the list of commits in range (in this sample its the last 3 commits)# In your case it will be the HEAD...<SHA1>$ git log HEAD...HEAD~3 --pretty="%T"06ae26a709d5b955adc0d760dd9faafcf9905820da3e68ae566bba72748843167844d5ffb72d8163270d08cd9867423987e1fa28e5b3658394cbe792
I want to know only the changes in that push.
If you wish to view the content and not the commits themself you can use whatchanged
git whatchanged
Once you what is your referenced commit you can see the list of files which were updated during this time period with the git whatchanged
command
# Print out a list of files which was updated/added between the 2 commits git whatchanged <TAG_NAME>...HEAD