通常该命令用于将工作区(working tree)中的内容注册到暂存区(index)
命令格式
git update-index
[–add] [–remove | –force-remove] [–replace]
[–refresh] [-q] [–unmerged] [–ignore-missing]
[(–cacheinfo <mode>,<object>,<file>)…]
[–chmod=(+|-)x]
[–[no-]assume-unchanged]
[–[no-]skip-worktree]
[–[no-]fsmonitor-valid]
[–ignore-submodules]
[–[no-]split-index]
[–[no-|test-|force-]untracked-cache]
[–[no-]fsmonitor]
[–really-refresh] [–unresolve] [–again | -g]
[–info-only] [–index-info]
[-z] [–stdin] [–index-version <n>]
[–verbose]
[–] [<file>…]
命令参数选项
- –add: 如果指定的文件不在暂存区(index)中,则将其加入暂存区。
例子
增加工作区新文件到暂存区
1 | [root@localhost git_update_index]# git init |