Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSauli Laitinen
5,992 PointsWhen to use -a in commit?
When should I use -a in commit and when i should not use it?
In other words, what is the difference between:
git commit -a -m "comment"
and
git commit -m "comment"
2 Answers
Michael Hulet
47,913 PointsThe -a
flag tells git to commit all the changes it finds. It essentially allows you to skip ever running git add
Mathew Kurian
4,698 PointsI had this same question also. So if you create 5 new files and then run "git commit", does it just add all the files?
Michael Hulet
47,913 PointsRunning git commit
without staging anything will do nothing. You must either run git add
first, or run git commit -a
instead