Now I use the following to get the list of changed files my current branch has, comparing it to master (the compare-to branch is easily changed):
git log --oneline --pretty="format:" --name-only master.. | awk 'NF' | sort -u
Before, I used to rely on this:
git log --name-status <branch>..<branch> | grep -E '^[A-Z]\b' | sort -k 2,2 -u
which outputs a list of files only and their state (added, modified, deleted):
A foo/bar/xyz/foo.txt
M foo/bor/bar.txt
...
The -k2,2
option for sort, makes it sort by file path instead of the type of change (A, M, D,).