6

From Powershell I've called git commit and it presents me with

enter image description here

I typed the commit message (in yellow) but I have no idea what to do next. Pressing Enter just adds a newline to my input. How do I complete the commit? I've been through several tutorials but none of them explained the next step.

EDIT: So I found I can press : to make the cursor jump to the bottom line, then type wq to complete the commit. What exactly is this? Is it correct? Are there any alternatives?

Ryan Bemrose
  • 9,018
  • 1
  • 41
  • 54
Bobbler
  • 633
  • 1
  • 7
  • 21
  • 2
    You can also use `:x` or just `ZZ` [no `` needed and which is shortand for the `:x`]. These have the virtue [over `:wq`] that they will terminate `vi` but will _not_ write to the file (i.e. change the mtime) unless [pending] changes have been made in the `vi` edit. – Craig Estey May 29 '16 at 03:14
  • Possible duplicate of [How to exit the VIM editor?](http://stackoverflow.com/questions/11828270/how-to-exit-the-vim-editor) – 1615903 May 30 '16 at 05:49
  • And if you prefer some other editor, see here for how to configure: http://stackoverflow.com/q/2596805/1615903 – 1615903 May 30 '16 at 05:50

1 Answers1

10

After typing the message, press Escape to exit insert mode and then type :wq (write/save and quit, or :q! if you want to cancel and return to the prompt). Alternatively, you can commit in one step by typing git commit -m "message"

Martin Ciz
  • 266
  • 1
  • 5
  • 9