1

I would love some help to write a shell script that will return the list of files skipped by my git repository.

There is an example code below

%> bash git_ignore.sh | cat -e
.DS_Store$
mywork.c~$

Thank you.

phd
  • 82,685
  • 13
  • 120
  • 165

1 Answers1

4

To list all ignored files you can try

find . -type f  | git check-ignore --stdin

EDIT:

  • find . -type f find all files in current directory and any sub-directories.
  • git check-ignore check if a file is excluded by gitignore.

In this case will all files in current directory, and any sub-directories, be feed to check-ignore and any file that are excluded by gitignore will be printed out.

joran
  • 2,815
  • 16
  • 18