I have a weird case - My git was working fine till an hour ago or so but now when I try to run
git add * --all
I get an error saying error: unknown switch `C'.
Below is the output I got. I just pulled from the repo which had some changes and after that I started getting this error. Tried poking around a bit and found that the error comes because of the *
sign. If I remove that, it works....
$ git add * --all
error: unknown switch `C'
usage: git add [options] [--] <pathspec>...
-n, --dry-run dry run
-v, --verbose be verbose
-i, --interactive interactive picking
-p, --patch select hunks interactively
-e, --edit edit current diff and apply
-f, --force allow adding otherwise ignored files
-u, --update update tracked files
-N, --intent-to-add record only the fact that the path will be added later
-A, --all add changes from all tracked and untracked files
--ignore-removal ignore paths removed in the working tree (same as --no-all)
--refresh don't add, only refresh the index
--ignore-errors just skip files which cannot be added because of errors
--ignore-missing check if - even missing - files are ignored in dry run
You should not have options (like --all
) like after parameters (like filenames). So try switching them around:
git add --all *
Additionally, if a filename begins with a minus it will be mis-interpreted as an option (a file -Clown
looks like options -C -l -o -w -n
to programs on the commandline). To mitigate this you can stop option parsing using --
:
git add --all -- *