I am not able to write git commit message. I want to write
Fixes issue #10 - one line description of changes
I am not able to type anything inside git console. It does not take any keystrokes that I type in.
-
2Are you familiar with vim? It's the default console editor. Press I to go into insert mode and ESC to go into 'normal' mode where you can move around the text.Dan Schnau– Dan Schnau2017-12-28 12:28:40 +00:00Commented Dec 28, 2017 at 12:28
-
@DanSchnau No I am not familiar with vim I am new to git.Ice fire– Ice fire2017-12-28 12:29:34 +00:00Commented Dec 28, 2017 at 12:29
-
1Check this to change what editor git useshttps://stackoverflow.com/questions/2596805/how-do-i-make-git-use-the-editor-of-my-choice-for-commits#2596835Dan Schnau– Dan Schnau2017-12-28 12:29:53 +00:00Commented Dec 28, 2017 at 12:29
3 Answers
This editor seems to be a variant of vim. Initially you are not in edit mode, to be able to input stuff press the i key to enter input mode. This allows you to type whatever you want.
After entering your message you need to hit esc to exit input mode. Then you need to issue a command to save and close, which can be done by typing :wq. : means the start of the command. w is used for saving (write) and the q let's you quit the editor.
Alternatively it is also possible to write a commit message without using this editor as the other answer explains.
2 Comments
:x! am I right ?:q, the exclamation mark should only be used when wanting to force your command. In the case of the quit command that could for example be quitting without saving (thus discarding your changes). If you want to exit the editor after saving your commit message you can just exit normally, if you want to discard your commit message (and commit) you will have to force it. This however will require you to restart the entire committing process.When you commit with git, it will use vim to prompt you to type in your commit message. Vim is a popular editing program but it does take a bit of getting used to. You can either search for a quick vim crash course or change the default editor: How do I make Git use the editor of my choice for commits?
