search

Home  >  Q&A  >  body text

git中如何同时为多个文件写commit信息

问题1:

假设我add了一系列文件, 我希望在写commit注释的时候,分别为每个文件写commit信息.
另外由于我经常使用Sublime,我可能希望写commit信息时弹出Sublime的窗口

我在Google时组织的关键词为git commit message for many files, 但是没有得到理想的结果.

衍生问题1: 如何设置sublime为git的默认editor

我的关键字为 "git default editor sublime Windows7",但是得到的结果非常繁琐,在自己机器上试验也未能成功 这是一个坑吗?

环境=>Windows7_64+git1.9.5+Sublime3

update:
2015-4-1
感谢各位的回答,我又在网上找了找信息,现在做一个总结:
主要是对提交粒度的控制,如果粒度太小,每个文件都add和commit,会累死人的; 如果粒度过大,那么别人根本不知道某些文件是什么鬼;
所以粒度适中最好,属于同一类的文件则同时commit,统一写commit信息; 另外文件命名做到见名知意; 不要有强迫症,要对自己写的代码和代码注释有信心,自己能看懂,别人也能看懂

问题2嘛=>祝福自己早日脱离win吧

phpcn_u1582phpcn_u15822768 days ago987

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师2017-05-02 09:21:23

    I don’t have a win environment, so I can only answer your first question

    Since it is a commit message, it is of course an explanation of the commit, so your idea cannot be realized unless each file is committed separately :)

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-02 09:21:23

    Since each document has a different interpretation, can it be submitted separately?
    One submission is a valid modification, and these files can share the same explanation~

    reply
    0
  • 某草草

    某草草2017-05-02 09:21:23

    Question 1
    Git is not designed to comment files individually in a commit
    The purpose of the commit message is to remind you what changes have been made in this commit compared to the previous version
    It should not be specific about what has been changed in a certain file

    If you insist on commenting on a single file
    You can only commit each file separately

    Question 2

    1. Add the path of sublimeText to path
      If the addition is successful, please use where subl to test under git bash

    2. Set sublime as default editor
      git config --global core.editor "subl -w"

    sublimeText2 does not have subl.exe 要用 sublime_text代替 subl

    reply
    0
  • Cancelreply