I have a repo with master branch started from scratch and HEAD pointing on arbitrary commit.
I'd like to get list of all changed files from the beginning of the branch up to commit B. I could accomplish that using
git diff --name-only A..B
Here is your answer:
git rev-list --max-parents=0 HEAD is the initial commit.
git diff --name-only `git rev-list --max-parents=0 HEAD`..B will show you the list of files that differ between the initial commit and commit
Here a clever hack is mentioned - creating an empty tree object:
git diff --name-only $(git mktree </dev/null)..B