git中如何同时为多个文件写commit信息
phpcn_u1582
phpcn_u1582 2017-05-02 09:19:23
0
3
908

问题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_u1582
phpcn_u1582

reply all (3)
Peter_Zhu

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 :)

    漂亮男人

    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~

      某草草

      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 usewhere sublto test under git bash

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

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

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!