Alvar Alvar - 9 months ago 34
Git Question

List all changed files in git repo from the beginning of master up to specific commit

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

But unfortunately there is no commit A.

Is there a way to point on Ā«beginning of the timeĀ» or any other command for getting list of changed files up to specific commit?


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 B


Here a clever hack is mentioned - creating an empty tree object:

git diff --name-only $(git mktree </dev/null)..B