How do patches work in Git?

后端 未结 6 1338
遥遥无期
遥遥无期 2020-12-23 12:02

I\'m new to Git, but familiar with SVN. As a test I made a repository in a local directory with git init. Then I cloned the empty repository (over SSH using 127

6条回答
  •  既然无缘
    2020-12-23 12:40

    With Git 2.25 (Q1 2020), git format-patch evolves to better use the branch description ("git branch --edit-description") as subject.

    See commit bf8e65b, commit a92331d, commit 46273df (15 Oct 2019) by Denton Liu (Denton-L).
    (Merged by Junio C Hamano -- gitster -- in commit b75ba9b, 10 Nov 2019)

    format-patch: teach --cover-from-description option

    Signed-off-by: Denton Liu

    Before, when format-patch generated a cover letter, only the body would be populated with a branch's description while the subject would be populated with placeholder text.

    However, users may want to have the subject of their cover letter automatically populated in the same way.

    Teach format-patch to accept the --cover-from-description option and corresponding format.coverFromDescription config, allowing users to populate different parts of the cover letter (including the subject now).

    The git config documentation now includes:

    format.coverFromDescription:
    

    The default mode for format-patch to determine which parts of the cover letter will be populated using the branch's description.

    And git format-patch:

    --cover-from-description=:
    

    Controls which parts of the cover letter will be automatically populated using the branch's description.

    • If is message or default, the cover letter subject will be populated with placeholder text.
      The body of the cover letter will be populated with the branch's description. This is the default mode when no configuration nor command line option is specified.

    • If is subject, the first paragraph of the branch description will populate the cover letter subject.
      The remainder of the description will populate the body of the cover letter.

    • If is auto, if the first paragraph of the branch description is greater than 100 bytes, then the mode will be message, otherwise subject will be used.

    • If is none, both the cover letter subject and body will be populated with placeholder text.

提交回复
热议问题