I want to list the files currently tracked in a git repository.
So, I do git ls-files. However doing so, gives me the entire list including all the sub-directories, their sub-directories and so on..
I do not want this. Is there a way where I can specify the depth of the output of ls-files command?
Suppose I have a git repo:
mainrepo/
sub-dir1
subdir1.1
subdir1.1.1
sub-dir2
I only want to go to depth 1, perse. That means I only want ls-files to ouput
sub-dir1
sub-dir2
A somewhat rudimentary way is to strip each line up to (and including) an optional
/character, and get the unique lines from that:(Note that I haven’t been able to test this personally yet, because I’m on Windows using a limited Bash shell.)