I made a bunch of updates inside a directory and would like to add them, but they sit beside a directory which I have in my .gitignore. Shouldn't git add
just ignore that instead of complaining?
How can I add everything and just skip the thing being ignored?
$ git add assets/*
The following paths are ignored by one of your .gitignore files:
assets/avatars
Use -f if you really want to add them.
fatal: no files added
According to documentation, the --ignore-errors
flag would just make the command work as you'd like.
If some files could not be added because of errors indexing them, do not abort the operation, but continue adding the others. The command shall still exit with non-zero status. The configuration variable add.ignoreErrors can be set to true to make this the default behaviour.
Update:
This doesn't work in this case, I guess because the assets/*
parameter is expanded by the shell so that the actual parameters received by git add
are the expanded list of files and directories and so the failure is explicit.
I've tried this command with good results:
$ git add assets
It works even without the option --ignore-errors
because it doesn't try to add the ignored directory below assets
.
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