Applying git patches from a mailing list

后端 未结 2 1467
[愿得一人]
[愿得一人] 2020-12-19 11:23

I need to apply a patch(from a mailing list) into a local git repository

The patch in the mailing list has a cover message and a brief information about it. I can c

相关标签:
2条回答
  • 2020-12-19 11:50

    You have the choice of git apply and git am with git mailinfo.

    The git mailinfo command will process the email message and will separate the patch from the log, but usually you can simply use git am. Also please note the --scissors,

    --scissors

    Remove everything in body before a scissors line. A line that mainly consists of scissors (either ">8" or "8<") and perforation (dash "-") marks is called a scissors line, and is used to request the reader to cut the message at that line. If such a line appears in the body of the message before the patch, everything before it (including the scissors line itself) is ignored when this option is used.

    0 讨论(0)
  • 2020-12-19 12:11

    If you do use [git am][1], don't use any "scissor" mark (using the [-c/--scissor option][2])

    Use only -- >8 --.

    With Git 2.29 (Q4 2020), the explanation of the "scissors line" has been clarified.

    See commit 287416d (28 Sep 2020) by Evan Gates (deepcube).
    (Merged by Junio C Hamano -- gitster -- in commit 9839cce, 04 Oct 2020)

    Doc: show example scissors line

    Signed-off-by: Evan Gates

    The text tries to say the code accepts many variations that look remotely like scissors and perforation marks, but gives too little detail for users to decide what is and what is not taken as a scissors line for themselves.

    Instead of describing the heuristics more, just spell out what will always be accepted, namely "-- >8 --", as it would not help users to give them more choices and flexibility and be "creative" in their scissors line.

    git mailinfo now includes in its man page:

    Remove everything in body before a scissors line (e.g. "-- >8 --"). The line represents scissors and perforation marks, and is used to request the reader to cut the message at that line. [1]: https://git-scm.com/docs/git-am [2]: https://git-scm.com/docs/git-am#Documentation/git-am.txt--c

    0 讨论(0)
提交回复
热议问题