search

Home  >  Q&A  >  body text

git commit时message的问题

在执行git commit的时候,有两种办法为该commit添加message信息
一种是git commit -m 'your message'
另一种是git commit会打开commit-editmsg文件以供编辑message信息
现在的问题是, 打开后(我设定在sublime中打开)在文件里写了相关信息并保存, 接下来怎么办呢?
再执行一次git commit还是打开新的message文件。

黄舟黄舟2767 days ago1497

reply all(4)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-02 09:38:49

    You just set up sublime without adding parameters... It may be a problem caused by your failure to set it up successfully.

    And git commit actually needs to wait for the return value of your editor. If you fail to make the editor return a value, then you will definitely not be able to save the message

    reply
    0
  • 高洛峰

    高洛峰2017-05-02 09:38:49

    The vim editor is opened. By default, the ones starting with # will be ignored.
    After you save, only the part you wrote will be saved.
    Press Esc, then: x to save and exit. There is no need to submit it again.

    If you want to use sublime, you can refer here
    https://help.github.com/articles/associating-text-editors-with-git/#using-sublime-text-as-your-editor
    After saving, close it Okay, then you can check the log

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-02 09:38:49

    After writing the comments, save->close sublime; only then will git complete this submission.
    However, it is still recommended to use the default vim.

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-02 09:38:49

    No matter how you open the commit message file, after modification, save it directly. At this time, it means git commit -m "..."接下来使用git st查看状态或者git log查看日志。如果有远程,请git push.

    reply
    0
  • Cancelreply