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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28146646/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 02:50:22  来源:igfitidea点击:

What is the difference between "git add -A" and "git add --update :/"?

git

提问by Alan2

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 :/实际上有什么区别吗?

回答by Charlie

git add --update :/will update or remove previously tracked files from the entire working tree. It will not add new files.

git add --update :/将从整个工作树中更新或删除以前跟踪的文件。它不会添加新文件。

git add -Awill also update, remove previously tracked files, but it will also add new files. As this command doesn't have the explicit pathspecof :/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 add -A还将更新、删除以前跟踪的文件,但也会添加新文件。由于该命令没有明确pathspec:/,你的更新命令执行,这取决于你的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