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 The Staging Area

Craig Curtis
Craig Curtis
19,985 Points

touch fileX, edit fileX, git commit -m "Do I need to add before commit?"

I edited in nano, and did 'git commit -m "Add filex"' Checked with 'git log' to see commit changes, and it showed up...

So is 'git add fileX' unnecessary? Is it automagically handled by 'git commit' ?

1 Answer

deckey
deckey
14,630 Points

Hi Craig, git commit won't magically add the file, no. Use git status to see what files will be included if committed (also called staged/unstaged) If you want to commit a file, you need to do git add on it first, it will show up green in console if git status is called. Then you can git commit

hope it helps, good luck!