I know the different git add commands/flags like -a, -u, etc. However, does just "git add" do anything? When i use it, I get the message: Nothing specified, nothing added. Maybe you wanted to say 'git add .'? Is there not a default for git add?
Asked
Active
Viewed 122 times
-1
-
What would the default be? – evolutionxbox Apr 30 '20 at 23:04
-
i thought it would be git add -a? – robats Apr 30 '20 at 23:38
-
It has no default, but you can make an alias. https://stackoverflow.com/questions/19416195/how-to-make-git-add-all-by-default and https://superuser.com/questions/1017246/specify-a-default-action-for-git-add and https://stackoverflow.com/questions/3538774/is-it-possible-to-override-git-command-by-git-alias/3538791#3538791 – evolutionxbox Apr 30 '20 at 23:41
-
1**git itself is telling you** that it is an invalid command because you did not specify anything, which implies there is no default. I'm confused why you think asking Stack Overflow will change anything. I don't mean to come off as harsh, but just sayin' – Inigo May 01 '20 at 02:15
-
1Because in another stack overflow post, they mentioned that -A is the default. Thats why I asked again. https://stackoverflow.com/a/26343584/10599094 – robats May 01 '20 at 22:58
-
That's referencing _"git add
" is the same as "git add -A – evolutionxbox May 02 '20 at 14:15" now._
1 Answers
1
If you run git add
with no flags or other arguments, as in:
git add
(and press Enter or Return), the command prints the warning / usage message that you observed and quits. It does not update Git's index in any way.
Is there not a default for git add?
That is the default: print that warning/usage message and quit.

torek
- 448,244
- 59
- 642
- 775
-
1I'm surprised that such an established SO user would answer this rather than comment and flag it as a low quality question. SO has a problem with noise. – Inigo May 01 '20 at 02:17
-
@Inigo: I was going to close it as a duplicate of [this](https://stackoverflow.com/questions/19416195/how-to-make-git-add-all-by-default), but realized that it's not really the *same* question... – torek May 01 '20 at 04:49
-
@Inigo but it's *not* a low quality question. The flag should be reserved for pure gibberish - things that aren't comprehensible, aren't coherent, probably are meaningless. This question is none of those - it's clear, it's formatted correctly, does not even need outside intervention. The only issue is that it's on the trivial side but that doesn't make it flaggable. You are free to downvote if is a bad question in your opinion but don't flag it. – VLAZ May 01 '20 at 08:16
-
@VLAZ, ok, i'm just learning the community standards, which I at least know have been under intense debate (including between the two founders) . But [from the Help Center](https://meta.stackexchange.com/questions/92074/what-can-i-do-when-getting-this-question-body-does-not-meet-our-quality-standar): "If your question is so brief that it could be looked up in a dictionary or reference book/site trivially, it might not be a good fit on our network." He didn't even need to look it up. **git itself is telling him**: *there is no default for `git add`*. – Inigo May 01 '20 at 08:31
-
@Inigo that would make it under researched, not so bad it needs to be deleted. There is a big difference - the former needs a downvote at most, while the latter a flag that would need to be reviewed and acted upon with some amount of urgency. Also, the link you give is not for what humans flag, it's for the automatic filter. Again, flags are for *serious* issues. – VLAZ May 01 '20 at 08:53
-
@VLAZ I guess I'm in Jeff Atwood's corner then. I think SO would be more useful if the noise was deleted... or else change the search algo so questions/answers with <2 votes are ranked very low. – Inigo May 01 '20 at 09:30