简体   繁体   English

“git add -A”和“git add --update :/”有什么区别?

[英]What is the difference between “git add -A” and “git add --update :/”?

I was in the past using this Git command for my files:我过去曾对我的文件使用此 Git 命令:

add --update :/ 

as someone told me this was the best way to pick up all the files that had been added, deleted and updated.正如有人告诉我的那样,这是获取所有已添加、删除和更新的文件的最佳方式。

However after reading: Difference between "git add -A" and "git add ."但是阅读后: “git add -A”和“git add”之间的区别。

I think maybe I should be using git add -A我想也许我应该使用git add -A

Can someone tell me if there's a difference and what git add --update :/ actually does?有人可以告诉我是否存在差异以及git add --update :/实际上的作用吗?

git add --update :/ will update or remove previously tracked files from the entire working tree. git add --update :/将从整个工作树中更新或删除以前跟踪的文件。 It will not add new files.它不会添加新文件。

git add -A will also update, remove previously tracked files, but it will also add new files. git add -A也将更新、删除以前跟踪的文件,但它也会添加新文件。 As this command doesn't have the explicit pathspec of :/ that your update command does, depending on your version of git, this may be for all files in the entire working tree, or it may be for the current directory and all subfolders and files.由于此命令没有:/的显式路径规范,您的更新命令根据您的 git 版本,这可能适用于整个工作树中的所有文件,也可能适用于当前目录和所有子文件夹和文件。

For more info, the docs for git add can be found: http://git-scm.com/docs/git-add有关更多信息,可以找到 git add 的文档: http : //git-scm.com/docs/git-add

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM