“git add -A”之间的区别和“git add”。 [英] Difference between "git add -A" and "git add ."
问题描述
命令 git add [--all | -A]
看起来与 git add。
相同。它是否正确?如果不是,它们又有什么不同?
Git version 2.x , 总结: 详细资料: 关于 你可以用这样的东西来测试差异(注意,对于Git 2.x版本,你的输出为 The command For Git version 2.x, see answers below too. Summary: Detail: The important point about You can test the differences out with something like this (note that for Git version 2.x your output for
这篇关于“git add -A”之间的区别和“git add”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
git add -A
阶段全部
git add。
阶段新增和修改,未删除
git add -u
阶段已修改和删除,没有新的
git add -A
相当于 git add。; git add -u
。
git add。
的重要一点是它看看工作树,并将所有这些路径添加到阶段性更改中,如果它们被更改或者是新的并且不被忽略,则它不会执行任何'rm'操作。
git add -u
查看所有已被跟踪的文件,并对这些文件的更改进行分级(如果它们不同或已被删除)。它不会添加任何新文件,它只会修改已经跟踪的文件。
git add -A
是一个方便的快捷方式做这两个。
git add。
git status
will 不同):
git init
echo改变我> change-me
echo删除我> delete-me
git add change-me delete-me
git commit -m initial
echo OK>> change-me
rm delete-me
echo添加我> add-me
git status
#修改但未更新:
#修改:change-me
#deleted:delete-me
#未记录文件:
#add-me
git add。
git status
#要提交的更改:
#新文件:add-me
#modified:change-me
#更改但未更新:
#deleted:delete-me
git reset
git add -u
git status
#更改为提交:
#修改:change-me
#deleted:delete-me
#未记录文件:
#add-me
git reset
git add -A
git status
#要提交的更改:
#新文件:add-me
#modified:change -me
#deleted:delete-me
git add [--all|-A]
appears to be identical to git add .
. Is this correct? If not, how do they differ?
git add -A
stages Allgit add .
stages new and modified, without deletedgit add -u
stages modified and deleted, without new
git add -A
is equivalent to git add .; git add -u
.git add .
is that it looks at the working tree and adds all those paths to the staged changes if they are either changed or are new and not ignored, it does not stage any 'rm' actions.git add -u
looks at all the already tracked files and stages the changes to those files if they are different or if they have been removed. It does not add any new files, it only stages changes to already tracked files.git add -A
is a handy shortcut for doing both of those.git add .
git status
will be different):git init
echo Change me > change-me
echo Delete me > delete-me
git add change-me delete-me
git commit -m initial
echo OK >> change-me
rm delete-me
echo Add me > add-me
git status
# Changed but not updated:
# modified: change-me
# deleted: delete-me
# Untracked files:
# add-me
git add .
git status
# Changes to be committed:
# new file: add-me
# modified: change-me
# Changed but not updated:
# deleted: delete-me
git reset
git add -u
git status
# Changes to be committed:
# modified: change-me
# deleted: delete-me
# Untracked files:
# add-me
git reset
git add -A
git status
# Changes to be committed:
# new file: add-me
# modified: change-me
# deleted: delete-me