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 ls-files:

  • .gitignore
  • index.html
  • assets/app.less
  • assets/app.css
  • assets/app.js

But I don’t want the assets/app.less and .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.

Git Baby is a git and github fan, let's start git clone.