1

I am following along in a video on treehouse, and in the my_really_cool_projects folder we are using git commit for the first time.

In the video, they use git commit and it opens up in nano. On my mac, it opens in VIM. I can't figure out what to do next? I don't know the vim shortcut for Save.

At any rate, I'd like to be able to open git commit in nano so I can follow the tutorials.

In addition to this, I now have a different problem in that if I try to run git commit again, I get:

Swap file ".git/.COMMIT_EDITMSG.swp" already exists!

Can someone help me get back on track?

3
  • 1
    rm -f .git/.COMMIT_EDITMSG.swp. In order to save in vi/vim, you can say :w, :wq or :x. Commented Oct 15, 2013 at 11:52
  • When you've already found out that git commit has taken you to Vim, you didn't manage to google a solution to how to save and exit vi / Vim?! google.com/?q=git+change+commit+editor will tell you how to change the editor. But don't get me wrong: First steps are hard, and welcome to Git (and maybe later, Vim, too?) Both are powerful tools! Commented Oct 15, 2013 at 12:05
  • @IngoKarkat I was able to find this on google, but to be honest, I was hesitant to make many command line changes without verification, as I didnt want to get too far off the main road of the tutorial I was following. While theres a TON of useful information via google, sometimes its hard to discern what any unintended consequences might be :) Thanks! Commented Oct 15, 2013 at 12:25

1 Answer 1

5

The command to save and exit in vim is :x, however, you might want to use an editor you are familiar with first. I don't know what is the default editor in OS X, but you can tell Git to use that with:

git config --global core.editor <myeditor>
Sign up to request clarification or add additional context in comments.

1 Comment

@PhilPowis, yes, that's exactly that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.