Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Mercurial has a command to list every file that the repository has for every revision:

hg manifest --all

Is there an equivalent command in Git?

share|improve this question
Something like git log --stat? – jmreicha Sep 22 '11 at 17:54
git ls-files? – N.N. Sep 22 '11 at 21:42
Just curious, for what reason do you need this? – Stephen Jennings Sep 25 '11 at 8:24
@StephenJennings: it's a nicer way to know what sort of files one has under version control than mentally doing "ls -R minus .gitignore". The usefulness in general: one may more-or-less know what is going on, but introspection of the repository gives one confidence that one knows. Especially for beginning users, such confidence makes a big difference in how pleasant the program is to use. Git does not make reassuring its users a priority, which is why so many people understandably hate it until they learn it. – Esteis Sep 16 '12 at 21:50

I am absolutely terrible at shell scripts so this is most certainly sub-optimal, but this sort of thing might do it for you, assuming you're using bash. Hopefully someone else can come by and clean it up, or replace it with something better. I've only tested it on my Mac, so beware.

It ought to print all files in commits which are ancestors of the current HEAD. Save it in a file called somewhere in your path:


TFILE=$(mktemp -t git-manifest)

for sha in $(git log --pretty=format:%H)
    git ls-tree --name-only --full-tree -r $sha >> $TFILE

sort -u $TFILE
share|improve this answer
No need to export since it doesn't need to be available in child processes. If the loop is over SHA hashes, the loop works just fine, otherwise something using read and quoting the variable would be better. sort has a -u option that does what uniq does. The file won't get rmd when you cancel halfway through, you'd need a trap for that, but that'd probably be excessive for this script. – Daniel Beck May 8 '12 at 4:31
@DanielBeck: Thanks, I updated it slightly. mktemp doesn't exist in Git Bash, I should figure out a way to deal with that so Windows can play too. – Stephen Jennings May 8 '12 at 5:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .