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

Jen Hamilton
Jen Hamilton
9,994 Points

Error in Code Challenge: Staging Our Changes

I'm not able to get past challenge 5 of 6 for this code challenge. I've tried every combination to commit changes, but nothing works:

Challenge: Now let's commit all the changes we made to the staging area.

git commit -a -m "message"
git commit -a
git commit -m prototype.html "message"

That first command should have worked, I don't know what the problem is. Any suggestions?

12 Answers

Jen Hamilton
Jen Hamilton
9,994 Points

Never mind, it's just way pickier than I thought.

git commit -m "message"
Andrew McCormick
Andrew McCormick
17,730 Points

wow.. just sat there for 5 minutes typing in various -a , -am, -a -m... etc thanks

James Barnett
James Barnett
39,199 Points

The command line is picky about what you type, each of those things does something different.

Andrew McCormick
Andrew McCormick
17,730 Points

yeah, but I was just trying anything. When it said let's commit all the changes, I thought the -a flag was appropriate.
I read now that -a adds files and commits them rather than just committing the staged file. So if I'm working on 30 tracked files and needing to commit them all, I guess it would be better for me to just git commit -a, rather than adding each file and then committing?

This is good because I'm currently going through this challenge and stuck thinking the -a was appropriate.

Caesar Bell
Caesar Bell
24,829 Points

but to save all the changes I thought you had to use the -a tag?

Reed Williams
Reed Williams
3,323 Points

Same here. Maybe this is a point in the tutorial for revision.

I was stunk there also. Why so many times nobody change it?

The tutorial was a bit unclear on this point...I would agree with others here.

Ken Wilson
Ken Wilson
7,885 Points

This is extremely unclear. It should really be git commit-a based on the question but this comes up incorrect.

TJ Tijerina
TJ Tijerina
15,273 Points

Damn... this problem is already 2 years old? Thanks to all here. I was confused that my answer didn't work

Stephen Garner
Stephen Garner
Courses Plus Student 11,241 Points

yeah man. seems a little strange that "git commit -a" doesn't work. it should work according to the question.

sergei zh
sergei zh
2,687 Points

Hello, support team of treehouse!! I have same issue, but it looks like entire treehouse company out of the office, don't read any posts and unable to help...

Hello all,


"The correct answer is actually not to use the -a flag. The question is asking you to commit all of the changes in the staging area, not all of the changes. By default git will only commit changes that have been staged, or added to the staging area (which is what the git add command does). The -a flag is a shortcut that will add all of your current changes to the staging area first before running the commit command.

This is a subtle distinction but it's an important one - sometimes you may have changed 15 files but you only want to commit changes to 5 of them (maybe the others just had debug changes, or are related to a separate change that you're working on at the same time). By adding those changes to the staging area first and then committing only what's in the staging area you can make sure that your work stays separated.

Hopefully that helps. Feel free to let me know if I can help out any further." -Tommy Morgan


The correct answer is in the video "The Staging Area". If, people are still unable to figure out the correct answer I will post it in a response.

Thank you ...this question is the key to understanding the staging area

Omar Farag
Omar Farag
4,573 Points

Wow. I've been stuck for a day doing this. Thanks.

damn it .... really....