[英]Git, adding changes to commit, difference between add and commit flags
Is -a
in git commit -a
equivalent to git add . -A
是-a
在git commit -a
等同于git add . -A
add . -A
? add . -A
?
Assuming i have the following aliases: 假设我有以下别名:
12 alias gita='git add . -A'
13 alias gits='clear; git status'
14 alias gitlog='git log --pretty=oneline --abbrev-commit'
15 alias commit='git commit -a '
16 alias check='gita;commit' <--------------------------
When i say check
, is there any redundancy happening when i both add -A
and commit -a
当我说check
,当我add -A
和commit -a
时,是否有任何冗余发生
git add -A
is NOT equivalent to the -a
flag in git commit
. git add -A
不等同于git commit
的-a
标志。 git add -u
is. git add -u
是。 It adds changes to tracked files (including rms). 它添加了对跟踪文件(包括rms)的更改。 git add -A
also brings in untracked files. git add -A
还会引入未跟踪的文件。
Since git add -A
is superset of git add -u
, that is enough and you need not specify the -a
in commit as well. 由于git add -A
是git add -u
超集, git add -u
足够了,你也不需要在提交中指定-a
。
Also, 也, if the path is not given, it is assumed to be . 。 .
如果没有给出路径,则假定为.
, so the .
所以.
is superfluous as well 也是多余的
Starting git 2.0 (mid 2013), you will need to add the path, or git add -A
would operate on the full working tree. 启动git 2.0(2013年中),您需要添加路径,或者git add -A
将在完整工作树上运行。
See " Difference of “ git add -A
” and “ git add .
” ". 请参阅“ git add -A
”和“ git add .
”的区别git add .
“
Sort of. 有点。 git add -A
will match against the working tree and the index, adding new files, marking modified files and removing deleted files. git add -A
将匹配工作树和索引,添加新文件,标记已修改文件和删除已删除文件。 git commit -a
will stage only files that have been added or modified, but new files will not be added unless already specified in a prior git add
git commit -a
将仅播放已添加或修改的文件,但除非已在先前的git add
指定,否则不会添加新文件
Is -a in git commit -a equivalent to git add . 是-a在git commit -a中等同于git add。 -A? -一种?
No it is not. 不它不是。 git add . git add。 -u is. -u是。
When i say check, is there any redundancy happening when i both add -A and commit -a 当我说检查时,当我添加-A和commit -a时,是否有任何冗余发生
No git commit -a will simply add the remaining files by itself. 没有git commit -a只会自己添加剩余的文件。 In this case: none. 在这种情况下:没有。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.