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 trialokilydokily
12,105 PointsDoes git commit -a also include files that have never been added to the staging area?
.
2 Answers
Gabbie Metheny
33,778 PointsIf a file has never been added to the staging area, it is untracked, and the -a
flag will not add and commit the changes. (You can run git status
to see if the file shows as "untracked.") If you do want to add it, run git add <filename>
and then commit as normal. Once that file is tracked, the -a
flag will add it to the staging area, if git finds any changes since the last commit.
(more in this stack overflow post on all the ways to add, or ignore, untracked files)
Joshua Ouma
20,865 PointsGit commit -a commits all changes that have been made. So yes, it includes files that have not been added to the staging area