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

Development Tools Git Basics Getting Started With Git Commitment Therapy

I am a little confused about when it is 'good practice' to include the file name in a git commit statement with -a

git commit -a -m ~some_file_name "message" / git commit -a -m "message"

What is the difference in the above two commands? Will the second commit changes to all files with changes pending? If it will shouldn't I specify the file (or files) I want to commit changes to?

I assume by default, "git commit -a -m \"message\"" will commit all changes to any file specified. And all changes to all files in the current directory?

1 Answer

Usually you would cd (change directory) into your directory before you save your commit changes with git commit -am "your_message" which eliminates the need to include the file name before your git message.

Thank you Michael. Git seems simple at first, but then gets a little confusing - hope once I practice a bit, it starts seeming simple again. Kinda like playing chess - you can learn how the pieces move fairly quickly, but spend a lifetime truly mastering them.