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 trial

General Discussion

Version Control - Why don't you need to specify a filename when committing?

At the end of the Committing Changes module we committed a second piece of our README file.

$ git commit -a -m “Added some stuff”

I was curious why we wouldn’t need to specify that you’re referring to the README file?


$ git commit README -a -m “Added some stuff”

2 Answers

Ryan Field
Ryan Field
Courses Plus Student 21,242 Points

Someone can correct me if I'm wrong, but the flag -a here, I believe, stands for all, meaning it will commit all files that are in the staging area.

Kevin Korte
Kevin Korte
28,148 Points

Because technically you are passing in the -a flag in your commit. This means you are telling git to automatically stage all files that have been modified or deleted, but new files that Git doesn't know about will not be affected.