Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I produce a list of filenames (incl. paths) that git knows about over the course of the whole history?

share|improve this question
add comment

1 Answer 1

up vote 8 down vote accepted

Naive solution:

git rev-list --all | xargs -n1 git ls-tree --full-name -r --name-only  | sort -u

This lists all commits, then uses that to list all files in every commit. sort deduplicates. Only works for small-ish repos though as it takes a long time.

A better solution would be to use libgit2 to do the same, should be faster but requires some programming. A quick hack that implements this can be found on github. It uses pygit2 and is an order of magnitude faster than the shell pipeline above.

share|improve this answer
    
Awesome, thanks a lot. –  timmy Dec 17 '12 at 12:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.