search

Home  >  Q&A  >  body text

github - git commit操作问题

本人git初学者,前几天照着书上的教程在git bash中输入指令,当我输入$git commit时进入了一个编辑器,然后我就按照说明,在第一行输入了commit标题然后空一行,接下来输入description,当我输完后,却不知道怎么退出来,以进行后续的操作。求老司机解救。

翻车现场:

淡淡烟草味淡淡烟草味2755 days ago656

reply all(3)I'll reply

  • 滿天的星座

    滿天的星座2017-05-02 09:45:29

    The interface to enter is vim, just use vim commands

    • Save and exit :wq

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-02 09:45:29

    You didn’t specify what editor to use, so git took the default value - Vim. If you haven't learned it, of course you won't know how to exit Vim or Emacs. You can set it to another editor, such as nano or kate, etc. Or learn Vim.

    In addition, it is not recommended to use a large amount of -m 选项。有特别的理由时才使用(比如在脚本中)。因为使用 -m 不方便输入比较长的消息,并且涉及到转义什么的。不过最重要的是,使用 -m 你就没有机会审阅你将要提交的修改了!(建议使用 git commit -v, so you can see what your modifications look like and whether there is anything missing or added. )

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-02 09:45:29

    Press esc然后输入:x,或者直接git commit -am "你的git注释"

    reply
    0
  • Cancelreply