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 Committing Changes

Lido Fernandez
Lido Fernandez
10,556 Points

I have a problem for commit in Mac

I am trying to commit a change for my README file and I get this:

I have no idea what to do next

testing the systemt.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
#
# Initial commit
#
# Changes to be committed:
#       new file:   README
#
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
recording

2 Answers

Matthew Spear
Matthew Spear
14,534 Points

I think you've managed to launch vi or vim and start recording a macro!

You'll probably want to find a way of switching your text editor to something slightly easier to use like nano.

Vim is funny, to edit as you would in a normal text editor you can hit the i key which puts you into insert mode, type your commit with an empty line between title and description then hit esc to get out of insert mode and type the command :wq to write and quit the file.

I prefer writing my commit message inline:

git commit -m "Commit message here"

the -m flag stands for message

you can also add -a to commit all the files like so: git commit -a -m "Commit message here"

Has that helped / answered the question?

Lok C
Lok C
10,617 Points

"You'll probably want to find a way of switching your text editor to something slightly easier to use like nano."

In case anyone else is having the same problem and trying to do above. The command needed is:

git config --global core.editor "nano"

After this, you will see this same screen as appeared in the video, instead of the vim screen.

Note: This worked on Mac.

Jane Eyer
Jane Eyer
2,586 Points

If ctrl + x does not work for you then your git is using vim. In that case, Press esc and type ":wq" (w- means for write, q - means for quit) and press enter.

In the future if you want to use nano as a default text editor. then go to the main screen on terminal. type: nano ~/.gitconfig

The above command line will open an empty file and in the empty file type: git config core.editor "nano"

then press ctrl + x and enter to save and get out.

Happy gitting :D