git ls-files excluding files from .myignorefile
I want to get all files from a repository but ignoring files that are not listed or don’t match in the .gitignore file using regular expressions or some kind of options such as “exclude-from=.myignorefile”.
Let’s say these are my files after I do
- git rename many files and folders
- How do I view all ignored patterns set with svn:ignore recursively in an SVN repository?
- Git diff - ignore reorder
- Git > diffs filtered, show only certain changed classes/files
- Make git-grep ignore large text files
- How to search (grep) across all files, in all branches, in all repos in Stash?
But I don’t want the
.gitignore files to be shown. Is there any option to accomplish this? I thought exclude-from was going to do the job but I misunderstood it:
Read exclude patterns from <file>; 1 per line.
Edit: I don’t list those files in the .gitignore file because I want to track them but I don’t want to use them for something else, lets say not uploading them to an ftp server.
One Solution collect form web for “git ls-files excluding files from .myignorefile”
I don’t think
git ls-files can do this. But you can pipe its output to
grep (or other) and exclude whatever you want, for example:
$ git ls-files | grep -v -e ^.gitignore -e ^assets/app.less index.html assets/app.css assets/app.js