git add 之间的任何区别。和 git add --all?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23003118/
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
Any difference between git add . and git add --all?
提问by Pat
Is there any difference between:
之间有什么区别:
git add .
and
和
git add --all
?
?
回答by xdazz
git add --all
will add the deleted file too (removing files from index that are no longer in the working tree), while git add .
does not.
git add --all
也会添加已删除的文件(从索引中删除不再位于工作树中的文件),而git add .
不会。
For new files and files already tracked in current working tree:
对于新文件和已在当前工作树中跟踪的文件:
git add .
For only files already tracked in current working tree:
仅针对当前工作树中已跟踪的文件:
git add -u
For new files, files already tracked in current working tree, and remove files from index that are no longer in the working tree:
对于新文件,已在当前工作树中跟踪的文件,并从索引中删除不再在工作树中的文件:
git add -A
or
或者
git add --all
回答by Golu
The accepted answer is valid for Git 1.x. But for Git versions from 2.0 and above, following is the difference:
接受的答案对 Git 1.x 有效。但是对于 2.0 及以上版本的 Git,区别如下:
git add .
Adds, modifies and removes index entries/files in the current directory and its subdirectories.
添加、修改和删除当前目录及其子目录中的索引条目/文件。
While
尽管
git add -all
And
和
git add -A
Adds, modifies and removes all index entries/files to match the entire working treeof the repository.
添加、修改和删除所有索引条目/文件以匹配存储库的整个工作树。