git add -u与-A .三者的区别
git add -u:将文件的修改、文件的删除,添加到暂存区。
git add .:将文件的修改,文件的新建,添加到暂存区。
git add -A:将文件的修改,文件的删除,文件的新建,添加到暂存区。
-u就是update的意思,只会标记本地有改动(包括删除和修改)的已经追踪的文件
-u, –update
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).
-A 就是all的意思,会标记本地所有有改动(包括删除和修改)和新增的文件
-A, –all, –no-ignore-removal
Update the index not only where the working tree has a file matching but also where the index already has an entry. This adds, modifies, and removes index entries to match the working tree.
If no is given when -A option is used, all 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 -A 提交所有变化
git add -u 提交被修改(modified)和被删除(deleted)文件,不包括新文件(new)
git add . 提交新文件(new)和被修改(modified)文件,不包括被删除(deleted)文件
新一代开源开发者平台 GitCode,通过集成代码托管服务、代码仓库以及可信赖的开源组件库,让开发者可以在云端进行代码托管和开发。旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。
更多推荐


所有评论(0)