What is the difference between these two commands?
git commit -m "added a new page"
and
git commit -a -m "added a new page"
I know that the -a option will stage files that have been modified and deleted, but then what does running it without the -a mean?
You have to explicitly stage changes for commitment by using
git addorgit rm.If you use the
-aflag when doing a commit, git will automatically stage any modified and removed files without you having to explicitly stage them usingaddorrm, etc.If you don’t specify
-a, any files that have been modified or removed, but not explicitly staged usinggit addorgit rmwill be ignored in the commit.update
As Dr. Gianluigi Zane Zanettini says –
-adoes not add new files to the index, so if you have completely new files you shouldn’t expect-ato ad them.http://www.kernel.org/pub/software/scm/git/docs/git-commit.html