Comments on How to use the gitignore file without git(1).
Parent
How to use the gitignore file without git(1).
+1
−0
How can a file list be manually filtered with a gitignore file.
I want to do the equivalent of git ls-files
, but it should work even if I remove .git
, so I can't use git(1).
Currently, I'm doing
find . -not -type d \
| grep -v ^.git$ \
| grep -v other-files-specified-in-the-gitignore
But this means I'm duplicating the .gitignore file. How can I do this without hard-coding the contents of .gitignore in this script?
Post
+1
−0
You can fake out git
as long as you have some empty Git repository available somewhere.
git --git-dir=path-to-empty-repo/.git \
ls-files --others --exclude-standard
0 comment threads