Is there a way (from the command line) to list the names of all files changed in a PR in Git/GitHub? This would be used to find what tests need to be run in a Travis CI build for that PR.
The CI build runs these commands before it calls our script:
git clone --depth=50 git://github.com/jekyll/jekyll.git jekyll/jekyll
cd jekyll/jekyll
git fetch origin +refs/pull/2615/merge
git checkout -qf FETCH_HEAD
In general, you can list the files changed between any two commits with git diff --name-only
:
How to list only the file names that changed between two commits?
The problem here seems to be determining the 'merge base'. If all branches originate with master, then you could do:
git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD master)
This will show you the changes between the point at which the FETCH_HEAD
was branched from master
to the current FETCH_HEAD
. I tested this locally, and the PR branches are cut from master
I believe it should work.