代码之家  ›  专栏  ›  技术社区  ›  David Jones

为什么我不能运行git add-uA?

git
  •  1
  • David Jones  · 技术社区  · 12 年前

    在提交之前,我通常使用以下命令将新创建的文件添加到存储库中:

    git add -A
    

    然后,我运行以下命令从存储库中删除已删除的文件:

    git add -u
    

    当我试图一起运行这些命令时,我被告知它们是互斥的:

    git add -uA
    

    我显然错过了什么。为什么这些命令是互斥的?

    1 回复  |  直到 12 年前
        1
  •  2
  •   twalberg    12 年前

    因为 git add -A 做任何事情 git add -u 有,再加上一些额外的:

       -A, --all
           Like -u, but match <filepattern> against files in the working tree in addition to
           the index. That means that it will
           find new files as well as staging modified content and removing files that are no
           longer in the working tree.
    

    git加法-A 对于你正在做的事情来说应该足够了。