Answer the question
In order to leave comments, you need to log in
How to get a list of monitored and indexed files and directories in Git, excluding subdirectories?
Good.
Problem You
need to get a list of the names of all monitored and indexed files and directories in the current directory, excluding all subdirectories.
For example, for a structure like this:
/.git/...
/folder/subfolder/file.ext
/folder2/new.ext (новый проиндексированный файл)
/.gitignore
/file.ext
/ignoreme.ext (не отслеживаемый файл)
/new.ext (ещё один новый проиндексированный файл)
folder
folder2
.gitignore
file.ext
new.ext
git ls-tree --name-only HEAD
git ls-files
Answer the question
In order to leave comments, you need to log in
The script temporarily put all subfolders in .gitignore, track, and then rollback the .gitignore file.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question