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

James Nelson
James Nelson
23,956 Points

Git commit

I am watching the GIT basics videos and am on the step 'Committing Changes'. Once I have committed and write a message, I press enter however by doing so I am just given a new line. Is there a ctrl * button I should be entering to add my message successfully?

I am using terminal on mac

4 Answers

Casey Clayton
Casey Clayton
16,708 Points

The synax of it should be this

git commit -m "Your message here"

Then run a git status and what is highlighted in green is what has been added to the next commit.

James Barnett
James Barnett
39,199 Points

James Nelson -

> How do I commit Specific files then?

That's not how git works.


Committing changes via Git is done in 4 basic steps

  1. add file to be tracked
  2. make changes to a file
  3. commit changes
  4. push commits to repository

If you are still confused I'd suggest you review how git works either by re-watching the video or by checking out the git immersion tutorial.

James Nelson
James Nelson
23,956 Points

Ahhh ok. How do I commit Specific files then? Is it git commit 'filename' -m "Your'e message here"

Casey Clayton
Casey Clayton
16,708 Points

A specific file would be committed like this

git add filenamehere

Then you would run the commit after you have added the files you want. I would keep going with the Git videos on here as all this is covered.

Why is git commit -a -m "Your message here" wrong and git commit -m "Your message here" correct for the challenge task?