Is -a
in git commit -a
equivalent to git 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
git add -A
is NOT equivalent to the -a
flag in git commit
. git add -u
is. It adds changes to tracked files (including rms). git add -A
also brings in untracked files.
Since git add -A
is superset of git add -u
, that is enough and you need not specify the -a
in commit as well.
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.
See "Difference of “git add -A
” and “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 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
Is -a in git commit -a equivalent to git add . -A?
No it is not. git add . -u is.
When i say check, is there any redundancy happening when i both add -A and commit -a
No git commit -a will simply add the remaining files by itself. In this case: none.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With