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
           <pathspec>. This removes as well as modifies index entries to match
           the working tree, but adds no new files.


           If no <pathspec> 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
       -A, --all, --no-ignore-removal
           Update the index not only where the working tree has a file
           matching <pathspec> but also where the index already has an entry.
           This adds, modifies, and removes index entries to match the working
           tree.


           If no <pathspec> 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).


1.  git add -A   保存所有的修改

2.  git add .     保存新的添加和修改,但是不包括删除

3.  git add -u   保存修改和删除,但是不包括新建文件。

如图:




  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值