3

Considering that HEAD refers to my current branch (which isn't necessary master), how would I list all versioned files of a given directory (without the full recursive content)?

What I have tried:

I did play with git log (as in "git -> show list of files changed in recent commits in a specific directory", or "How can I search Git branches for a file or directory?"), but somehow it always gives me too much details.

I just need the list of versioned files directly under one directory.

Community
  • 1
  • 1
Pushparaj
  • 99
  • 2
  • 7

1 Answers1

3

I would try:

git ls-tree --name-only HEAD -- mydirectory/.

Note:

  • the '/.' after mydirectory in order to list the tree (file and subdirectories) directly under 'mydirectory'. Without the '-r' option, it won't be recursive.
  • the '--' in order to clearly separate the git options and arguments from the file/directory passed at the end.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250