As part of our CI build, we have a script that deploys the latest version of the project and leaves a comment on the corresponding PR with the subject from the previous commit and a link to the deploy.
However, sometimes these builds contain changes from multiple commits if a developer pushes multiple commits to the PR at the same time. I'd like to modify the script so that the message containing the link also contains the subject lines from each of these new commits.
The current implementation, that only gets the most recent commit, has a line of code similar to this:
COMMIT_MESSAGE=$(git --no-pager log --pretty=format:"%s" -1)
Is there some similar way I can interact with git to get the messages for all the commits that came from the same push as the most recent commit above?