https://stackoverflow.com/questions/37505484/cant-exit-git-commit-in-windows

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?

share improve this question
 
1  
You can also use :x<cr> or just ZZ [no <cr> 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 3:14
 
Possible duplicate of How to exit the VIM editor? –  1615903  May 30 '16 at 5:49
 
And if you prefer some other editor, see here for how to configure: stackoverflow.com/q/2596805/1615903 –  1615903  May 30 '16 at 5:50

1 Answer

up vote 3 down vote accepted

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"


https://stackoverflow.com/questions/37505484/cant-exit-git-commit-in-windows

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?

share improve this question
 
1  
You can also use :x<cr> or just ZZ [no <cr> 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 3:14
 
Possible duplicate of How to exit the VIM editor? –  1615903  May 30 '16 at 5:49
 
And if you prefer some other editor, see here for how to configure: stackoverflow.com/q/2596805/1615903 –  1615903  May 30 '16 at 5:50

1 Answer

up vote 3 down vote accepted

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"

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?

share improve this question
 
1  
You can also use :x<cr> or just ZZ [no <cr> 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 3:14
    
Possible duplicate of How to exit the VIM editor? –  1615903  May 30 '16 at 5:49
    
And if you prefer some other editor, see here for how to configure: stackoverflow.com/q/2596805/1615903 –  1615903  May 30 '16 at 5:50

1 Answer

up vote 3 down vote accepted

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"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值