/ 写在前面 – 我热爱技术、热爱开源。我也相信开源能使技术变得更好、共享能使知识传播得更远。但是开源并不意味着某些商业机构/个人可以为了自身的利益而一味地索取,甚至直接剽窃大家曾为之辛勤付出的知识成果,所以本文未经允许,不得转载,谢谢/


Synopsis

  1. git add [--verbose | -v] [--dry-run | -n] [--force | -f] [--interactive | -i] [--patch | -p]
  2. [--edit | -e] [--[no-]all | --[no-]ignore-removal | [--update | -u]]
  3. [--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing] [--renormalize]
  4. [--chmod=(+|-)x] [--pathspec-from-file=<file> [--pathspec-file-nul]]
  5. [--] [<pathspec>…]

[-u | --update]

Git - git-add Documentation:

Update the index just where it already has an entry matching . This removes as well as modifies index entries to match the working tree, but adds no new files.

If no is given when -u option is used, all tracked files in the entire working tree are updated (old versions of Git used to limit the update to the current directory and its subdirectories).

git add命令 - Git教程™

git add -u [<path>] :把 <path> 中所有跟踪文件中被修改过或已删除文件的信息添加到索引库。它不会处理那些不被跟踪的文件。省略 <path> 表示 . ,即当前目录。