What is this editor opened by "git commit --amend" in Windows 10 cmd and how do I use it?
Asked Answered
A

3

14

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.

Arianna answered 28/12, 2016 at 5:13 Comment(2)
It should also be possible to configure Git to use a different editor.Fineman
I think git is a very powerful scm. so I guess the default editor taken by Git should be very powerful as well.Ribal
C
28

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 :)

Cincture answered 28/12, 2016 at 6:17 Comment(2)
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!Sitra
From version 2.15.1, Git for Windows comes with "nano", and can be configured to use nano or Notepad++ straight from the installer.Cincture
E
16

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

Emboss answered 28/12, 2016 at 5:29 Comment(2)
ESC+w+q does not work for me. But ESC + : + w + q + ENTER works. What am I doing wrong?Boles
@Boles You aren't doing anything wrong, the answer just didn't mention those keys; I've added them.Lumberjack
P
0

try git config --global core.editor (any editor of your choice or if you have any of the following: Atom / Sublimetext/ notepad++/ notepad / etc)

in either Visual studio terminal while coding for git or in any command line.

example:- git config --global core.editor Atom

Prebendary answered 23/10, 2021 at 22:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.