9

Editor opened by default when using "git commit --amend" in Windows 10 cmd.

Windows 10 cmd opens up this editor by default when I try to edit a GIT commit message. Can you please tell me what that is and how I can use it? Thanks.

pedrorijo91
  • 6,833
  • 8
  • 37
  • 73
Aswin Koliyot
  • 518
  • 7
  • 9

2 Answers2

22

It is Vim, the default editor in Git installation. It is rather hard to use if you don't know how to use it! It is not trivial as other editors like Notepad++, Emacs or Sublime Text, though it is very powerful, and when you mastered it (it takes a few month of hard work! :) ), you'l become highly productive.

However you can easily configure git to use another editor. Fire up a command line and enter:

git config --global core.editor notepad

Now Windows Notepad is your default editor in git. You can easily change it to any editor of your choice. See here or here or here.

By the way, I recommend you to put the time and learn Vim! You'll not regret it :)

Mohammad Dehghan
  • 16,319
  • 3
  • 50
  • 66
  • 1
    As someone who just doesn't like Vim but wants to Keep that light-weight console workflow: ```git config --global core.editor nano```. Way easier to learn, works on all Unix systems (including macOS) and I just tested it on Windows with git. Works like a charm! – ecth Mar 13 '18 at 10:32
  • 1
    From version 2.15.1, Git for Windows comes with "nano", and can be configured to use nano or Notepad++ straight from the installer. – Mohammad Dehghan Mar 15 '18 at 19:43
13

It Vi and you have to write your message.
If you are unfamiliar with VI i recommend to go over this interactive tutorial

enter image description here

To edit the file and to write your commit message (insert mode)

i

To save your data:

Write + quit: ESC + : + w + q + Enter

To save your without saving data:

Write + quit: ESC + : + q + ! + Enter

Community
  • 1
  • 1
CodeWizard
  • 92,491
  • 19
  • 110
  • 133
  • `ESC`+`w`+`q` does not work for me. But `ESC` + `:` + `w` + `q` + `ENTER` works. What am I doing wrong? – Ves Dec 28 '16 at 11:54
  • 1
    @Ves You aren't doing anything wrong, the answer just didn't mention those keys; I've added them. – Dan Lowe Dec 28 '16 at 13:45