interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / Documentation / format-patch-caveats.adoc

33 lines · 1520 bytes Raw Blame History
1The output from linkgit:git-format-patch[1] can lead to a different
2commit message when applied with linkgit:git-am[1]. The patch that is
3applied may also be different from the one that was generated, or patch
4application may fail outright.
5ifdef::git-am[]
6See the <<discussion,DISCUSSION>> section above for the syntactic rules.
7endif::git-am[]
8
9ifndef::git-am[]
10include::format-patch-end-of-commit-message.adoc[]
11endif::git-am[]
12
13Note that this is especially problematic for unindented diffs that occur
14in the commit message; the diff in the commit message might get applied
15along with the patch section, or the patch application machinery might
16trip up because the patch target doesn't apply. This could for example
17be caused by a diff in a Markdown code block.
18
19The solution for this is to indent the diff or other text that could
20cause problems.
21
22This loss of fidelity might be simple to notice if you are applying
23patches directly from a mailbox. However, changes originating from Git
24could be applied in bulk, in which case this would be much harder to
25notice. This could for example be a Linux distribution which uses patch
26files to apply changes on top of the commits from the upstream
27repositories. This goes to show that this behavior does not only impact
28email workflows.
29
30Given these limitations, one might be tempted to use a general-purpose
31utility like `patch`(1) instead. However, `patch`(1) will not only look for
32unindented diffs (like linkgit:git-am[1]) but will try to apply indented
33diffs as well.