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!
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
Using Git Commit
I am trying to follow the tutorial to use Git from treehouse. I already added git add readme.txt and would like to do git commit
After that, the terminal looks like this
Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Committer: Christian <Christian@Christians-MacBook-Pro.local> # # On branch master # # Initial commit # # Changes to be committed: # new file: readme.txt # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
However, after I add the message above, I can't do anything to save, or exit, there is no help about command whatsoever at the bottom of the terminal. I tried ctrl x, cmd x, and some possible combinations just like what nano has. It didn't help.
Anyone knows whats wrong with my git? I am using git version 126.96.36.199(Apple Git-48)
Pedro GCA20,683 Points
Hey Christian, It seems you are using vim as text editor and not nano. If Im right, the commands for vim are completely different of nano's. In this case there is nothing wrong with git, you are just doing some command mistakes.
Instructions: After type your message --> type "esc" to exit the insert mode (vim text editor mode) --> then type :w which means save the file --> then type :q which means quit vim. Then your commit will be ok. Test it and let me know. ;)
For more information about vim commands click here.
Stone Preston42,016 Points
type your commit message, then press the esc key, then type
For future reference, you can use the -m flag on your commit command to specify a message without using the default editor:
git commit -m "this is the commit message"
Pedro GCA20,683 Points
No worries Christian,
1st: I don't know exactly how to show up vim commands in the terminal like nano, I guess the software does not give us this option, just because is a different software.
2nd: to change your default text editor for git:
git config --global core.editor nano
For more information check git website.
I hope I helped.
If you just made some changes and want to add everything and commit everything, the following two commands make it pretty easy. I find myself using this combination all the time:
- git add -A
- git commit -a -m "Comment on changes made goes here"