is there a way to gitignore all the current extra files?

[An] alternative would be to make a script which greps the filenames after git status‘ untracked files, and sends the output to .gitignore, which might be what I will end up doing.

For writing scripts, always try to use plumbing commands.

With git status there is the --porcelain option1 to turn it into a plumbing command. Consider also using git ls-files --others (-o for short) but note that you would want to add the --exclude-standard option.

Related, but not my main question: Is there a reason why git doesn’t include a git ignore command?

Define what, precisely, it would do; write one; and submit it and see if you can get it accepted. 🙂

1As always, I express my own bafflement as to why this option is not spelled --plumbing.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top