34

I would like to list the versioned files in the root directory of a git repository. To do the same thing in bazaar, you run:

bzr ls --versioned --non-recursive

How do I do this in git?

Christian Oudard
  • 48,140
  • 25
  • 66
  • 69
  • I'd call these *tracked* files in git, which is why this didn't come up in my google results. I guess that's not worth posting a duplicate, so here's the keyword. – Nikana Reklawyks Nov 05 '12 at 06:12

2 Answers2

42

It would be more helpful if you described exactly what listing you want to show. Guessing from the bzr document, I imagine that you want something like this.

git ls-tree --name-only HEAD

This lists the names of files in the current directory which are currently in the HEAD revision, which should be close to what you are asking for.

CB Bailey
  • 755,051
  • 104
  • 632
  • 656
8

I do not know what "bzr ls --versioned --non-recursive" does, but I suspect that it is either

or

  • "git ls-files" (perhaps additionally with --cached and --exclude-standard options), which lists specified kinds of files (by default it is files that are in index), and is recursive (and currently there is no way to turn off being recursive, as far as I know).
Community
  • 1
  • 1
Jakub Narębski
  • 309,089
  • 65
  • 217
  • 230