简体   繁体   English

在 Windows 10 cmd 中由“git commit --amend”打开的这个编辑器是什么,我该如何使用它?

[英]What is this editor opened by "git commit --amend" in Windows 10 cmd and how do I use it?

在 Windows 10 cmd 中使用“git commit --amend”时默认打开编辑器。

Windows 10 cmd opens up this editor by default when I try to edit a GIT commit message.当我尝试编辑 GIT 提交消息时,Windows 10 cmd 默认打开此编辑器。 Can you please tell me what that is and how I can use it?你能告诉我那是什么以及我如何使用它吗? Thanks.谢谢。

It is Vim , the default editor in Git installation. 它是Vim ,Git安装中的默认编辑器。 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. 像Notepad ++,Emacs或Sublime Text这样的其他编辑器并不是一件轻而易举的事情,虽然它非常强大,当你掌握它时(需要几个月的努力工作!:)),你会变得高效。

However you can easily configure git to use another editor. 但是,您可以轻松配置git以使用其他编辑器。 Fire up a command line and enter: 启动命令行并输入:

git config --global core.editor notepad

Now Windows Notepad is your default editor in git. 现在,Windows Notepad是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! 顺便说一句,我建议你花点时间学习Vim! You'll not regret it :) 你不会后悔的:)

It Vi and you have to write your message. 它Vi你必须写你的消息。
If you are unfamiliar with VI i recommend to go over this interactive tutorial 如果您不熟悉VI,我建议您阅读这个互动教程

在此输入图像描述

To edit the file and to write your commit message (insert mode) 编辑文件并编写提交消息(插入模式)

i 一世

To save your data: 要保存您的数据:

Write + quit: ESC + : + w + q + Enter 写+退出: ESC + + w + q + 回车

To save your without saving data: 要保存您的不保存数据:

Write + quit: ESC + : + q + ! 写+退出: ESC + + q + + Enter + 输入

try git config --global core.editor (any editor of your choice or if you have any of the following: Atom / Sublimetext/ notepad++/ notepad / etc)尝试 git config --global core.editor (您选择的任何编辑器,或者如果您有以下任何一种:Atom / Sublimetext/ notepad++/ notepad / etc)

in either Visual studio terminal while coding for git or in any command line.在为 git 或任何命令行编码时在 Visual Studio 终端中。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM