Git Immersion Labs 16, Creating a Reverting Commit

I'm having a lot of trouble creating a reverting commit. According to the instructions that I've followed (http://gitimmersion.com/lab_16.html), I made a change to a file and committed it, and am trying to revert that change by pushing another commit.

I typed in

git revert HEAD

where it mentions "This will pop you into the editor. You can edit the default commit message or leave it as is. Save and close the file. You should see …"

I'm not sure if this means I can pop into Sublime or just vim, but whenever I'm in vim I can't "save and close the file". I tried editing the comment and pressing esc + : wq + return but nothing happens.

Upvotes: 0

Views: 62

Answers (1)

abligh
abligh

Reputation: 25189

You will need to configure your editor:

git config --global core.editor emacs

(substituting emacs for nano, pico or something else you are familiar with).

The key sequence you want to save and exit from vim is ESC : w q RETURN. I realise that's pretty much what you wrote, but they way you wrote it, some of the keys had + between them implying you were pressing two keys at once (which won't work). In any case, better to use an editor you are happy with. Note that in many distributions, the default editor is not vim - though it looks a little like it - but some nano type thing, where (from memory, you want ^O X or similar).

Upvotes: 1

Related Questions