我有一个奇怪的情况 - 我的 git 工作正常直到一个小时左右,但现在当我尝试运行时
git add * --all
Run Code Online (Sandbox Code Playgroud)
我收到一条错误消息error:known switch `C'。
下面是我得到的输出。我刚刚从有一些更改的存储库中取出,之后我开始收到此错误。尝试了一下,发现错误是由于*符号造成的。如果我删除它,它会起作用......
$ 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
Run Code Online (Sandbox Code Playgroud)
您不应该--all在参数(如文件名)之后有选项(如 )。所以尝试交换它们:
git add --all *
Run Code Online (Sandbox Code Playgroud)
此外,如果文件名以减号开头,它将被错误地解释为选项(文件-Clown看起来像-C -l -o -w -n命令行上程序的选项)。为了缓解这种情况,您可以使用以下命令停止选项解析--:
git add --all -- *
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9963 次 |
| 最近记录: |