Reputation: 13592
git add --all
or git add -A
followed by git commit -m "commit message"
seem to produce a different result from git commit -am "commit message"
when I thought they would produce the same final result.
Am I doing something wrong with git commit -am "commit message"
?
Also is git commit -a -m "commit message"
the same as git commit -am "commit message"
?
Upvotes: 2
Views: 686
Reputation: 1323343
git add -A
will add new files (as well as deleted and modified files)git add -A
” and “git add .
”" for more.git commit -a
will not add new files: it will only stage files that have been modified and deleted.More generally, I always recommend to add first, check the status, and then commit.
I find that extra step a good opportunity to:
git commit -f file
)And yes, git commit -a -m "commit message"
is the same as git commit -am "commit message"
.
Upvotes: 4