Different between "git add --all" and "git add ."

At first, I always use "git add ." in the work, but I some times, I find if I remove some files in the track tree,and then push the "New Version" to remote git server, then I still can find the removed files in native git. so how is it? I need to delete the files in the server. So I will do like this:

For File:

git rm --cached filename

git commit -m "delete file in remote git."

git push [origin] [master]

For Folder:

git rm -r --cached foldername

git commit -m "delete folder in remote git."

git push [origin] [master]

It is so non-convenient,right? So how to avoid doing like this?

Way is using "git add --all"

"git add --all" == "git add ." + "git add -u"

"git add ." means track all the files that "new" and "modified";

"git add -u" means track all the files that "modified" and "deleted"

So in the project, if you just use "git add ." to track all the files, it will be work ok, but you should deal with all the dirty files in the remote git server.

Reference link:http://stackoverflow.com/questions/572549/difference-between-git-add-a-and-git-add

Thanks,

Blues

转载于:https://my.oschina.net/u/913344/blog/266406

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值