0

I want to understand the exclude pattern in git ls-files command. So I want to output all the ignored file within the working directory using the ls-files command. I know that git status --ignored will do the job, but my point is to understand using the exclude pattern in case I need it.

I tried this: git ls-files -i -x ./*.txt In order to output all the ignored (except text-files) files. No success though I have several ignored files.

Could you please help me with this?

Hairi
  • 3,318
  • 2
  • 29
  • 68

2 Answers2

1

try git ls-files -o -i -x '*.txt'

ElpieKay
  • 27,194
  • 6
  • 32
  • 53
0

A simple StackOverflow search would have answered your question.

Try any of these:

git ls-files --others -i --exclude-from=.git/info/exclude
git ls-files --others -i --exclude-standard

Reference: Git command to show which specific files are ignored by .gitignore

Community
  • 1
  • 1
Slartibartfast
  • 1,592
  • 4
  • 22
  • 33