I want to do something like git add *.java
and not let it throw up just because one of those files matched the .gitignore.
For example: In my directory I have
ignored.java
something.java
somethingelse.java
somethingevenmoreelse.java.
where the three last files were just created by me. I then want to do git add *.java
and have it add those three files. In other words, instead of giving me
The following paths are ignored by one of your .gitignore files:
ignored.java
Use -f if you really want to add them.
fatal: no files added
... I would rather it would just ignore the .gitignored files and add the rest.
If you quote the glob pattern then it will interpreted by git instead of the shell and it will ignore the ignored files before adding the rest without error.
git add '*.java'
alternatively:
git add \*.java
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With