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

This "git commit" format works in my console, but the quiz says it's wrong.

git commit -m "1st commit of index.html" index.html

The quiz asks us to commit the index.html file from the command line. The quiz says I didn't put quotes around the comment. I'm thinking it wasn't expecting a filename at the end of the command and just checked the end of my command for a quotation mark.

Is my command correct or not?

And is there a way I can paste a screen clipping of something in a Community question?

Thanks, Teresa

4 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Hi Theresa,

There's a course on Treehouse that will help you when posting code for help in Treehouse Community. Markdown Basics in the library will get you up to speed on that.

Now, with regard to your issue with the code challenge I'd need to see a link to it, to test it to be sure... but it might simply be an issue with the commit message you're using.

There's nothing much I can see wrong with the command except that you wouldn't use a file name in the commit stage.

I actually use git add . to stage files every time before I commit so even then, I never specify the file names no matter how big my project is.

Anyway, when you're trying again, make sure that the string in your commit message matches the instruction exactly. Then the code challenge should accept it and let you move. The code challenges can be quite picky about these things :)

Good luck :)

Jonathan,

Thanks for your reply. I'm thinking that there could be a time that you would just want to commit a particular file, but perhaps that doesn't occur. I thought the quiz wanted me to specifically commit that file.

"And now that it's been added to the repository, let's commit it."

If there were other files in the staging area that one was not yet prepared to commit, they would also be committed...yes? So I thought a more exact response to the quiz question would be to specify the file.

Question is #3 of 11 https://teamtreehouse.com/library/an-oldfashioned-gittogether

It is in the last Quiz of Getting "Started With Git" in the "Git Basics" course.

I'll check out "Markdown Basics" Thanks again Jonathan. Teresa

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Hi Therasa,

So yes, once you've added something to the staging area (or the repository) it'll autatomatically be committed with the commit command so it doesn't need to be specified again. You can of source specify files at your leisure with git add when adding files but I just prefer the git . shortcut.

For task 3 just write any message for your commit message. could be something like "add index.html" But you don't need to add index.html to the command like you did with git add . because git knows already that's what you want to do.

git commit -m "add index.html to repo" will be enough. :-)

Yes, I already understood everything you said. I think you're not getting my point, but thanks for the response anyway. I guess perhaps after a period of real time on the job work I will probably see that one would never want to commit just one of the files in the staging area and leave any others that may be there uncommitted.

Thanks again Joanathon.

In contrast to Step 3, Step 7 in that quiz says "Commit all of the changes in the staging area to the repository."

Then again, the course videos had not actually shown us a command specifying a file like the command I answered Question 3 with. I had to look up the command to know to put the filename at the end of the command.

Maybe question 3 could be "And now that it's been added to the repository, let's commit it along with anything else that may be in the staging area.."

Or better, leave the question as is and just accept an answer with or without the filename.

My last comment on this... I Promise :-)