€•Œsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ'/translations/zh_CN/process/backporting”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/zh_TW/process/backporting”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/it_IT/process/backporting”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/ja_JP/process/backporting”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/ko_KR/process/backporting”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/pt_BR/process/backporting”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/sp_SP/process/backporting”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)�”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…”�”}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒA/var/lib/git/docbuild/linux/Documentation/process/backporting.rst”h´KubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒ#Backporting and conflict resolution”h]”hŒ#Backporting and conflict resolution”…”�”}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhŒ field_list”“”)�”}”(hhh]”hŒfield”“”)�”}”(hhh]”(hŒ field_name”“”)�”}”(hŒAuthor”h]”hŒAuthor”…”�”}”(hhéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhhäh³hÇh´KubhŒ field_body”“”)�”}”(hŒ)Vegard Nossum ”h]”hŒ paragraph”“”)�”}”(hŒ(Vegard Nossum ”h]”(hŒVegard Nossum <”…”�”}”(hhÿh²hh³Nh´NubhŒ reference”“”)�”}”(hŒvegard.nossum@oracle.com”h]”hŒvegard.nossum@oracle.com”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:vegard.nossum@oracle.com”uh1jhhÿubhŒ>”…”�”}”(hhÿh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Khhùubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hhäubeh}”(h]”h ]”h"]”h$]”h&]”uh1hâh³hÇh´Khhßh²hubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝhhÊh²hh³hÇh´KubhŒtopic”“”)�”}”(hhh]”hŒ bullet_list”“”)�”}”(hhh]”(hŒ list_item”“”)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒ Introduction”…”�”}”(hjGh²hh³Nh´Nubah}”(h]”Œid2”ah ]”h"]”h$]”h&]”Œrefid”Œ introduction”uh1jhjDubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjAubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hj<ubj@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒApplying the patch to a tree”…”�”}”(hjih²hh³Nh´Nubah}”(h]”Œid3”ah ]”h"]”h$]”h&]”Œrefid”Œapplying-the-patch-to-a-tree”uh1jhjfubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjcubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hj<ubj@)�”}”(hhh]”(hþ)�”}”(hhh]”j)�”}”(hhh]”hŒResolving conflicts”…”�”}”(hj‹h²hh³Nh´Nubah}”(h]”Œid4”ah ]”h"]”h$]”h&]”Œrefid”Œresolving-conflicts”uh1jhjˆubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhj…ubj;)�”}”(hhh]”(j@)�”}”(hhh]”(hþ)�”}”(hhh]”j)�”}”(hhh]”hŒPrerequisite patches”…”�”}”(hjªh²hh³Nh´Nubah}”(h]”Œid5”ah ]”h"]”h$]”h&]”Œrefid”Œprerequisite-patches”uh1jhj§ubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhj¤ubj;)�”}”(hhh]”(j@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒgit log”…”�”}”(hjÉh²hh³Nh´Nubah}”(h]”Œid6”ah ]”h"]”h$]”h&]”Œrefid”Œgit-log”uh1jhjÆubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjÃubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjÀubj@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒ git blame”…”�”}”(hjëh²hh³Nh´Nubah}”(h]”Œid7”ah ]”h"]”h$]”h&]”Œrefid”Œ git-blame”uh1jhjèubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjåubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjÀubj@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒ#Prerequisite vs. incidental patches”…”�”}”(hj h²hh³Nh´Nubah}”(h]”Œid8”ah ]”h"]”h$]”h&]”Œrefid”Œ"prerequisite-vs-incidental-patches”uh1jhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjÀubeh}”(h]”h ]”h"]”h$]”h&]”uh1j:hj¤ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j?hj¡ubj@)�”}”(hhh]”(hþ)�”}”(hhh]”j)�”}”(hhh]”hŒUnderstanding conflict markers”…”�”}”(hj;h²hh³Nh´Nubah}”(h]”Œid9”ah ]”h"]”h$]”h&]”Œrefid”Œunderstanding-conflict-markers”uh1jhj8ubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhj5ubj;)�”}”(hhh]”(j@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒCombined diffs”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”Œid10”ah ]”h"]”h$]”h&]”Œrefid”Œcombined-diffs”uh1jhjWubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjTubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjQubj@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒ Better diffs”…”�”}”(hj|h²hh³Nh´Nubah}”(h]”Œid11”ah ]”h"]”h$]”h&]”Œrefid”Œ better-diffs”uh1jhjyubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjvubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjQubj@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒMerge styles and diff3”…”�”}”(hjžh²hh³Nh´Nubah}”(h]”Œid12”ah ]”h"]”h$]”h&]”Œrefid”Œmerge-styles-and-diff3”uh1jhj›ubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhj˜ubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjQubeh}”(h]”h ]”h"]”h$]”h&]”uh1j:hj5ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j?hj¡ubj@)�”}”(hhh]”(hþ)�”}”(hhh]”j)�”}”(hhh]”hŒ!Iterating on conflict resolutions”…”�”}”(hjÌh²hh³Nh´Nubah}”(h]”Œid13”ah ]”h"]”h$]”h&]”Œrefid”Œ!iterating-on-conflict-resolutions”uh1jhjÉubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjÆubj;)�”}”(hhh]”(j@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒResolution process”…”�”}”(hjëh²hh³Nh´Nubah}”(h]”Œid14”ah ]”h"]”h$]”h&]”Œrefid”Œresolution-process”uh1jhjèubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjåubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjâubj@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒDealing with file renames”…”�”}”(hj h²hh³Nh´Nubah}”(h]”Œid15”ah ]”h"]”h$]”h&]”Œrefid”Œdealing-with-file-renames”uh1jhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjâubeh}”(h]”h ]”h"]”h$]”h&]”uh1j:hjÆubeh}”(h]”h ]”h"]”h$]”h&]”uh1j?hj¡ubj@)�”}”(hhh]”(hþ)�”}”(hhh]”j)�”}”(hhh]”hŒGotchas”…”�”}”(hj;h²hh³Nh´Nubah}”(h]”Œid16”ah ]”h"]”h$]”h&]”Œrefid”Œgotchas”uh1jhj8ubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhj5ubj;)�”}”(hhh]”(j@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒFunction arguments”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”Œid17”ah ]”h"]”h$]”h&]”Œrefid”Œfunction-arguments”uh1jhjWubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjTubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjQubj@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒError handling”…”�”}”(hj|h²hh³Nh´Nubah}”(h]”Œid18”ah ]”h"]”h$]”h&]”Œrefid”Œerror-handling”uh1jhjyubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjvubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjQubj@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒRefactored code”…”�”}”(hjžh²hh³Nh´Nubah}”(h]”Œid19”ah ]”h"]”h$]”h&]”Œrefid”Œrefactored-code”uh1jhj›ubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhj˜ubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjQubeh}”(h]”h ]”h"]”h$]”h&]”uh1j:hj5ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j?hj¡ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j:hj…ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j?hj<ubj@)�”}”(hhh]”(hþ)�”}”(hhh]”j)�”}”(hhh]”hŒVerifying the result”…”�”}”(hjØh²hh³Nh´Nubah}”(h]”Œid20”ah ]”h"]”h$]”h&]”Œrefid”Œverifying-the-result”uh1jhjÕubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjÒubj;)�”}”(hhh]”(j@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒ colordiff”…”�”}”(hj÷h²hh³Nh´Nubah}”(h]”Œid21”ah ]”h"]”h$]”h&]”Œrefid”Œ colordiff”uh1jhjôubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjñubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjîubj@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒ Build testing”…”�”}”(hjh²hh³Nh´Nubah}”(h]”Œid22”ah ]”h"]”h$]”h&]”Œrefid”Œ build-testing”uh1jhjubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjîubj@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒRuntime testing”…”�”}”(hj;h²hh³Nh´Nubah}”(h]”Œid23”ah ]”h"]”h$]”h&]”Œrefid”Œruntime-testing”uh1jhj8ubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhj5ubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjîubeh}”(h]”h ]”h"]”h$]”h&]”uh1j:hjÒubeh}”(h]”h ]”h"]”h$]”h&]”uh1j?hj<ubj@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒSubmitting backports to stable”…”�”}”(hjih²hh³Nh´Nubah}”(h]”Œid24”ah ]”h"]”h$]”h&]”Œrefid”Œsubmitting-backports-to-stable”uh1jhjfubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjcubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hj<ubj@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒA few final words of advice”…”�”}”(hj‹h²hh³Nh´Nubah}”(h]”Œid25”ah ]”h"]”h$]”h&]”Œrefid”Œa-few-final-words-of-advice”uh1jhjˆubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhj…ubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hj<ubj@)�”}”(hhh]”hþ)�”}”(hhh]”j)�”}”(hhh]”hŒExamples”…”�”}”(hj­h²hh³Nh´Nubah}”(h]”Œid26”ah ]”h"]”h$]”h&]”Œrefid”Œexamples”uh1jhjªubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhj§ubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hj<ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j:hj7h²hh³Nh´Nubah}”(h]”Œcontents”ah ]”(Œcontents”Œlocal”eh"]”Œcontents”ah$]”h&]”uh1j5h³hÇh´K hhÊh²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ Introduction”h]”hŒ Introduction”…”�”}”(hjÜh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjÙh²hh³hÇh´Kubhþ)�”}”(hXvSome developers may never really have to deal with backporting patches, merging branches, or resolving conflicts in their day-to-day work, so when a merge conflict does pop up, it can be daunting. Luckily, resolving conflicts is a skill like any other, and there are many useful techniques you can use to make the process smoother and increase your confidence in the result.”h]”hXvSome developers may never really have to deal with backporting patches, merging branches, or resolving conflicts in their day-to-day work, so when a merge conflict does pop up, it can be daunting. Luckily, resolving conflicts is a skill like any other, and there are many useful techniques you can use to make the process smoother and increase your confidence in the result.”…”�”}”(hjêh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´KhjÙh²hubhþ)�”}”(hŒdThis document aims to be a comprehensive, step-by-step guide to backporting and conflict resolution.”h]”hŒdThis document aims to be a comprehensive, step-by-step guide to backporting and conflict resolution.”…”�”}”(hjøh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´KhjÙh²hubeh}”(h]”jVah ]”h"]”Œ introduction”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒApplying the patch to a tree”h]”hŒApplying the patch to a tree”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj h²hh³hÇh´Kubhþ)�”}”(hXSometimes the patch you are backporting already exists as a git commit, in which case you just cherry-pick it directly using ``git cherry-pick``. However, if the patch comes from an email, as it often does for the Linux kernel, you will need to apply it to a tree using ``git am``.”h]”(hŒ}Sometimes the patch you are backporting already exists as a git commit, in which case you just cherry-pick it directly using ”…”�”}”(hjh²hh³Nh´NubhŒliteral”“”)�”}”(hŒ``git cherry-pick``”h]”hŒgit cherry-pick”…”�”}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjubhŒ~. However, if the patch comes from an email, as it often does for the Linux kernel, you will need to apply it to a tree using ”…”�”}”(hjh²hh³Nh´Nubj')�”}”(hŒ ``git am``”h]”hŒgit am”…”�”}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjubhŒ.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Khj h²hubhþ)�”}”(hŒôIf you've ever used ``git am``, you probably already know that it is quite picky about the patch applying perfectly to your source tree. In fact, you've probably had nightmares about ``.rej`` files and trying to edit the patch to make it apply.”h]”(hŒIf you’ve ever used ”…”�”}”(hjRh²hh³Nh´Nubj')�”}”(hŒ ``git am``”h]”hŒgit am”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjRubhŒ›, you probably already know that it is quite picky about the patch applying perfectly to your source tree. In fact, you’ve probably had nightmares about ”…”�”}”(hjRh²hh³Nh´Nubj')�”}”(hŒ``.rej``”h]”hŒ.rej”…”�”}”(hjlh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjRubhŒ5 files and trying to edit the patch to make it apply.”…”�”}”(hjRh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K$hj h²hubhþ)�”}”(hX It is strongly recommended to instead find an appropriate base version where the patch applies cleanly and *then* cherry-pick it over to your destination tree, as this will make git output conflict markers and let you resolve conflicts with the help of git and any other conflict resolution tools you might prefer to use. For example, if you want to apply a patch that just arrived on LKML to an older stable kernel, you can apply it to the most recent mainline kernel and then cherry-pick it to your older stable branch.”h]”(hŒkIt is strongly recommended to instead find an appropriate base version where the patch applies cleanly and ”…”�”}”(hj„h²hh³Nh´NubhŒemphasis”“”)�”}”(hŒ*then*”h]”hŒthen”…”�”}”(hjŽh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒhj„ubhX˜ cherry-pick it over to your destination tree, as this will make git output conflict markers and let you resolve conflicts with the help of git and any other conflict resolution tools you might prefer to use. For example, if you want to apply a patch that just arrived on LKML to an older stable kernel, you can apply it to the most recent mainline kernel and then cherry-pick it to your older stable branch.”…”�”}”(hj„h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K)hj h²hubhþ)�”}”(hXzIt's generally better to use the exact same base as the one the patch was generated from, but it doesn't really matter that much as long as it applies cleanly and isn't too far from the original base. The only problem with applying the patch to the "wrong" base is that it may pull in more unrelated changes in the context of the diff when cherry-picking it to the older branch.”h]”hX„It’s generally better to use the exact same base as the one the patch was generated from, but it doesn’t really matter that much as long as it applies cleanly and isn’t too far from the original base. The only problem with applying the patch to the “wrongâ€� base is that it may pull in more unrelated changes in the context of the diff when cherry-picking it to the older branch.”…”�”}”(hj¦h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K2hj h²hubhþ)�”}”(hXCA good reason to prefer ``git cherry-pick`` over ``git am`` is that git knows the precise history of an existing commit, so it will know when code has moved around and changed the line numbers; this in turn makes it less likely to apply the patch to the wrong place (which can result in silent mistakes or messy conflicts).”h]”(hŒA good reason to prefer ”…”�”}”(hj´h²hh³Nh´Nubj')�”}”(hŒ``git cherry-pick``”h]”hŒgit cherry-pick”…”�”}”(hj¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj´ubhŒ over ”…”�”}”(hj´h²hh³Nh´Nubj')�”}”(hŒ ``git am``”h]”hŒgit am”…”�”}”(hjÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj´ubhX is that git knows the precise history of an existing commit, so it will know when code has moved around and changed the line numbers; this in turn makes it less likely to apply the patch to the wrong place (which can result in silent mistakes or messy conflicts).”…”�”}”(hj´h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K9hj h²hubhþ)�”}”(hXZIf you are using `b4`_. and you are applying the patch directly from an email, you can use ``b4 am`` with the options ``-g``/``--guess-base`` and ``-3``/``--prep-3way`` to do some of this automatically (see the `b4 presentation`_ for more information). However, the rest of this article will assume that you are doing a plain ``git cherry-pick``.”h]”(hŒIf you are using ”…”�”}”(hjæh²hh³Nh´Nubj)�”}”(hŒ`b4`_”h]”hŒb4”…”�”}”(hjîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œb4”Œrefuri”ŒKhttps://people.kernel.org/monsieuricon/introducing-b4-and-patch-attestation”uh1jhjæŒresolved”KubhŒE. and you are applying the patch directly from an email, you can use ”…”�”}”(hjæh²hh³Nh´Nubj')�”}”(hŒ ``b4 am``”h]”hŒb4 am”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjæubhŒ with the options ”…”�”}”(hjæh²hh³Nh´Nubj')�”}”(hŒ``-g``”h]”hŒ-g”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjæubhŒ/”…”�”}”(hjæh²hh³Nh´Nubj')�”}”(hŒ``--guess-base``”h]”hŒ --guess-base”…”�”}”(hj)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjæubhŒ and ”…”�”}”(hjæh²hh³Nh´Nubj')�”}”(hŒ``-3``”h]”hŒ-3”…”�”}”(hj;h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjæubhŒ/”…”�”}”hjæsbj')�”}”(hŒ``--prep-3way``”h]”hŒ --prep-3way”…”�”}”(hjMh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjæubhŒ+ to do some of this automatically (see the ”…”�”}”(hjæh²hh³Nh´Nubj)�”}”(hŒ`b4 presentation`_”h]”hŒb4 presentation”…”�”}”(hj_h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œb4 presentation”jþŒ#https://youtu.be/mF10hgVIx9o?t=2996”uh1jhjæjKubhŒa for more information). However, the rest of this article will assume that you are doing a plain ”…”�”}”(hjæh²hh³Nh´Nubj')�”}”(hŒ``git cherry-pick``”h]”hŒgit cherry-pick”…”�”}”(hjth²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjæubhŒ.”…”�”}”(hjæh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K?hj h²hubhŒtarget”“”)�”}”(hŒS.. _b4: https://people.kernel.org/monsieuricon/introducing-b4-and-patch-attestation”h]”h}”(h]”Œb4”ah ]”h"]”Œb4”ah$]”h&]”jþjÿuh1jŒh´KEhj h²hh³hÇŒ referenced”Kubj�)�”}”(hŒ8.. _b4 presentation: https://youtu.be/mF10hgVIx9o?t=2996”h]”h}”(h]”Œb4-presentation”ah ]”h"]”Œb4 presentation”ah$]”h&]”jþjouh1jŒh´KFhj h²hh³hÇjšKubhþ)�”}”(hŒ½Once you have the patch in git, you can go ahead and cherry-pick it into your source tree. Don't forget to cherry-pick with ``-x`` if you want a written record of where the patch came from!”h]”(hŒ~Once you have the patch in git, you can go ahead and cherry-pick it into your source tree. Don’t forget to cherry-pick with ”…”�”}”(hj§h²hh³Nh´Nubj')�”}”(hŒ``-x``”h]”hŒ-x”…”�”}”(hj¯h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj§ubhŒ; if you want a written record of where the patch came from!”…”�”}”(hj§h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´KHhj h²hubhþ)�”}”(hŒ�Note that if you are submitting a patch for stable, the format is slightly different; the first line after the subject line needs to be either::”h]”hŒ�Note that if you are submitting a patch for stable, the format is slightly different; the first line after the subject line needs to be either:”…”�”}”(hjÇh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´KLhj h²hubhŒ literal_block”“”)�”}”(hŒ!commit upstream”h]”hŒ!commit upstream”…”�”}”hj×sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´KPhj h²hubhþ)�”}”(hŒor::”h]”hŒor:”…”�”}”(hjåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´KRhj h²hubjÖ)�”}”(hŒ%[ Upstream commit ]”h]”hŒ%[ Upstream commit ]”…”�”}”hjósbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´KThj h²hubeh}”(h]”jxah ]”h"]”Œapplying the patch to a tree”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒResolving conflicts”h]”hŒResolving conflicts”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´KWubhþ)�”}”(hŒBUh-oh; the cherry-pick failed with a vaguely threatening message::”h]”hŒAUh-oh; the cherry-pick failed with a vaguely threatening message:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´KYhjh²hubjÖ)�”}”(hŒ"CONFLICT (content): Merge conflict”h]”hŒ"CONFLICT (content): Merge conflict”…”�”}”hj'sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´K[hjh²hubhþ)�”}”(hŒWhat to do now?”h]”hŒWhat to do now?”…”�”}”(hj5h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K]hjh²hubhþ)�”}”(hŒÌIn general, conflicts appear when the context of the patch (i.e., the lines being changed and/or the lines surrounding the changes) doesn't match what's in the tree you are trying to apply the patch *to*.”h]”(hŒËIn general, conflicts appear when the context of the patch (i.e., the lines being changed and/or the lines surrounding the changes) doesn’t match what’s in the tree you are trying to apply the patch ”…”�”}”(hjCh²hh³Nh´Nubj�)�”}”(hŒ*to*”h]”hŒto”…”�”}”(hjKh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒhjCubhŒ.”…”�”}”(hjCh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K_hjh²hubhþ)�”}”(hŒóFor backports, what likely happened was that the branch you are backporting from contains patches not in the branch you are backporting to. However, the reverse is also possible. In any case, the result is a conflict that needs to be resolved.”h]”hŒóFor backports, what likely happened was that the branch you are backporting from contains patches not in the branch you are backporting to. However, the reverse is also possible. In any case, the result is a conflict that needs to be resolved.”…”�”}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Kchjh²hubhþ)�”}”(hXBIf your attempted cherry-pick fails with a conflict, git automatically edits the files to include so-called conflict markers showing you where the conflict is and how the two branches have diverged. Resolving the conflict typically means editing the end result in such a way that it takes into account these other commits.”h]”hXBIf your attempted cherry-pick fails with a conflict, git automatically edits the files to include so-called conflict markers showing you where the conflict is and how the two branches have diverged. Resolving the conflict typically means editing the end result in such a way that it takes into account these other commits.”…”�”}”(hjqh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Khhjh²hubhþ)�”}”(hŒyResolving the conflict can be done either by hand in a regular text editor or using a dedicated conflict resolution tool.”h]”hŒyResolving the conflict can be done either by hand in a regular text editor or using a dedicated conflict resolution tool.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Knhjh²hubhþ)�”}”(hXMany people prefer to use their regular text editor and edit the conflict directly, as it may be easier to understand what you're doing and to control the final result. There are definitely pros and cons to each method, and sometimes there's value in using both.”h]”hX Many people prefer to use their regular text editor and edit the conflict directly, as it may be easier to understand what you’re doing and to control the final result. There are definitely pros and cons to each method, and sometimes there’s value in using both.”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Kqhjh²hubhþ)�”}”(hŒvWe will not cover using dedicated merge tools here beyond providing some pointers to various tools that you could use:”h]”hŒvWe will not cover using dedicated merge tools here beyond providing some pointers to various tools that you could use:”…”�”}”(hj›h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Kvhjh²hubj;)�”}”(hhh]”(j@)�”}”(hŒ@`Emacs Ediff mode `__”h]”hþ)�”}”(hj®h]”j)�”}”(hj®h]”hŒEmacs Ediff mode”…”�”}”(hj³h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒEmacs Ediff mode”jþŒ)https://www.emacswiki.org/emacs/EdiffMode”uh1jhj°ubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Kyhj¬ubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hj©h²hh³hÇh´Nubj@)�”}”(hŒ:`vimdiff/gvimdiff `__”h]”hþ)�”}”(hjÑh]”j)�”}”(hjÑh]”hŒvimdiff/gvimdiff”…”�”}”(hjÖh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œvimdiff/gvimdiff”jþŒ#https://linux.die.net/man/1/vimdiff”uh1jhjÓubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´KzhjÏubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hj©h²hh³hÇh´Nubj@)�”}”(hŒ+`KDiff3 `__”h]”hþ)�”}”(hjôh]”j)�”}”(hjôh]”hŒKDiff3”…”�”}”(hjùh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒKDiff3”jþŒhttp://kdiff3.sourceforge.net/”uh1jhjöubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K{hjòubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hj©h²hh³hÇh´Nubj@)�”}”(hŒ>`TortoiseMerge `__”h]”hþ)�”}”(hjh]”j)�”}”(hjh]”hŒ TortoiseMerge”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œ TortoiseMerge”jþŒ*https://tortoisesvn.net/TortoiseMerge.html”uh1jhjubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K|hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hj©h²hh³hÇh´Nubj@)�”}”(hŒ&`Meld `__”h]”hþ)�”}”(hj:h]”j)�”}”(hj:h]”hŒMeld”…”�”}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒMeld”jþŒhttps://meldmerge.org/help/”uh1jhj<ubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K}hj8ubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hj©h²hh³hÇh´Nubj@)�”}”(hŒW`P4Merge `__”h]”hþ)�”}”(hj]h]”j)�”}”(hj]h]”hŒP4Merge”…”�”}”(hjbh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒP4Merge”jþŒIhttps://www.perforce.com/products/helix-core-apps/merge-diff-tool-p4merge”uh1jhj_ubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K~hj[ubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hj©h²hh³hÇh´Nubj@)�”}”(hŒ5`Beyond Compare `__”h]”hþ)�”}”(hj€h]”j)�”}”(hj€h]”hŒBeyond Compare”…”�”}”(hj…h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒBeyond Compare”jþŒ https://www.scootersoftware.com/”uh1jhj‚ubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Khj~ubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hj©h²hh³hÇh´Nubj@)�”}”(hŒI`IntelliJ `__”h]”hþ)�”}”(hj£h]”j)�”}”(hj£h]”hŒIntelliJ”…”�”}”(hj¨h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒIntelliJ”jþŒ:https://www.jetbrains.com/help/idea/resolve-conflicts.html”uh1jhj¥ubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K€hj¡ubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hj©h²hh³hÇh´Nubj@)�”}”(hŒF`VSCode `__ ”h]”hþ)�”}”(hŒE`VSCode `__”h]”j)�”}”(hjÊh]”hŒVSCode”…”�”}”(hjÌh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒVSCode”jþŒ8https://code.visualstudio.com/docs/editor/versioncontrol”uh1jhjÈubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K�hjÄubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hj©h²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1j:h³hÇh´Kyhjh²hubhþ)�”}”(hŒqTo configure git to work with these, see ``git mergetool --help`` or the official `git-mergetool documentation`_.”h]”(hŒ)To configure git to work with these, see ”…”�”}”(hjðh²hh³Nh´Nubj')�”}”(hŒ``git mergetool --help``”h]”hŒgit mergetool --help”…”�”}”(hjøh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjðubhŒ or the official ”…”�”}”(hjðh²hh³Nh´Nubj)�”}”(hŒ`git-mergetool documentation`_”h]”hŒgit-mergetool documentation”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œgit-mergetool documentation”jþŒ&https://git-scm.com/docs/git-mergetool”uh1jhjðjKubhŒ.”…”�”}”(hjðh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Kƒhjh²hubj�)�”}”(hŒG.. _git-mergetool documentation: https://git-scm.com/docs/git-mergetool”h]”h}”(h]”Œgit-mergetool-documentation”ah ]”h"]”Œgit-mergetool documentation”ah$]”h&]”jþj uh1jŒh´K†hjh²hh³hÇjšKubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒPrerequisite patches”h]”hŒPrerequisite patches”…”�”}”(hj4 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj1 h²hh³hÇh´K‰ubhþ)�”}”(hX­Most conflicts happen because the branch you are backporting to is missing some patches compared to the branch you are backporting *from*. In the more general case (such as merging two independent branches), development could have happened on either branch, or the branches have simply diverged -- perhaps your older branch had some other backports applied to it that themselves needed conflict resolutions, causing a divergence.”h]”(hŒƒMost conflicts happen because the branch you are backporting to is missing some patches compared to the branch you are backporting ”…”�”}”(hjB h²hh³Nh´Nubj�)�”}”(hŒ*from*”h]”hŒfrom”…”�”}”(hjJ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒhjB ubhX$. In the more general case (such as merging two independent branches), development could have happened on either branch, or the branches have simply diverged -- perhaps your older branch had some other backports applied to it that themselves needed conflict resolutions, causing a divergence.”…”�”}”(hjB h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K‹hj1 h²hubhþ)�”}”(hXŽIt's important to always identify the commit or commits that caused the conflict, as otherwise you cannot be confident in the correctness of your resolution. As an added bonus, especially if the patch is in an area you're not that familiar with, the changelogs of these commits will often give you the context to understand the code and potential problems or pitfalls with your conflict resolution.”h]”hX’It’s important to always identify the commit or commits that caused the conflict, as otherwise you cannot be confident in the correctness of your resolution. As an added bonus, especially if the patch is in an area you’re not that familiar with, the changelogs of these commits will often give you the context to understand the code and potential problems or pitfalls with your conflict resolution.”…”�”}”(hjb h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K“hj1 h²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒgit log”h]”hŒgit log”…”�”}”(hjs h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjp h²hh³hÇh´K›ubhþ)�”}”(hXˆA good first step is to look at ``git log`` for the file that has the conflict -- this is usually sufficient when there aren't a lot of patches to the file, but may get confusing if the file is big and frequently patched. You should run ``git log`` on the range of commits between your currently checked-out branch (``HEAD``) and the parent of the patch you are picking (````), i.e.::”h]”(hŒ A good first step is to look at ”…”�”}”(hj� h²hh³Nh´Nubj')�”}”(hŒ ``git log``”h]”hŒgit log”…”�”}”(hj‰ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj� ubhŒÄ for the file that has the conflict -- this is usually sufficient when there aren’t a lot of patches to the file, but may get confusing if the file is big and frequently patched. You should run ”…”�”}”(hj� h²hh³Nh´Nubj')�”}”(hŒ ``git log``”h]”hŒgit log”…”�”}”(hj› h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj� ubhŒD on the range of commits between your currently checked-out branch (”…”�”}”(hj� h²hh³Nh´Nubj')�”}”(hŒ``HEAD``”h]”hŒHEAD”…”�”}”(hj­ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj� ubhŒ/) and the parent of the patch you are picking (”…”�”}”(hj� h²hh³Nh´Nubj')�”}”(hŒ ````”h]”hŒ”…”�”}”(hj¿ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj� ubhŒ), i.e.:”…”�”}”(hj� h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K�hjp h²hubjÖ)�”}”(hŒ!git log HEAD..^ -- ”h]”hŒ!git log HEAD..^ -- ”…”�”}”hj× sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´K¤hjp h²hubhþ)�”}”(hŒ•Even better, if you want to restrict this output to a single function (because that's where the conflict appears), you can use the following syntax::”h]”hŒ–Even better, if you want to restrict this output to a single function (because that’s where the conflict appears), you can use the following syntax:”…”�”}”(hjå h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K¦hjp h²hubjÖ)�”}”(hŒ0git log -L:'\': HEAD..^”h]”hŒ0git log -L:'\': HEAD..^”…”�”}”hjó sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´Kªhjp h²hubhŒnote”“”)�”}”(hX´The ``\<`` and ``\>`` around the function name ensure that the matches are anchored on a word boundary. This is important, as this part is actually a regex and git only follows the first match, so if you use ``-L:thread_stack:kernel/fork.c`` it may only give you results for the function ``try_release_thread_stack_to_cache`` even though there are many other functions in that file containing the string ``thread_stack`` in their names.”h]”hþ)�”}”(hX´The ``\<`` and ``\>`` around the function name ensure that the matches are anchored on a word boundary. This is important, as this part is actually a regex and git only follows the first match, so if you use ``-L:thread_stack:kernel/fork.c`` it may only give you results for the function ``try_release_thread_stack_to_cache`` even though there are many other functions in that file containing the string ``thread_stack`` in their names.”h]”(hŒThe ”…”�”}”(hj h²hh³Nh´Nubj')�”}”(hŒ``\<``”h]”hŒ\<”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj ubhŒ and ”…”�”}”(hj h²hh³Nh´Nubj')�”}”(hŒ``\>``”h]”hŒ\>”…”�”}”(hj! h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj ubhŒ» around the function name ensure that the matches are anchored on a word boundary. This is important, as this part is actually a regex and git only follows the first match, so if you use ”…”�”}”(hj h²hh³Nh´Nubj')�”}”(hŒ!``-L:thread_stack:kernel/fork.c``”h]”hŒ-L:thread_stack:kernel/fork.c”…”�”}”(hj3 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj ubhŒ/ it may only give you results for the function ”…”�”}”(hj h²hh³Nh´Nubj')�”}”(hŒ%``try_release_thread_stack_to_cache``”h]”hŒ!try_release_thread_stack_to_cache”…”�”}”(hjE h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj ubhŒO even though there are many other functions in that file containing the string ”…”�”}”(hj h²hh³Nh´Nubj')�”}”(hŒ``thread_stack``”h]”hŒ thread_stack”…”�”}”(hjW h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj ubhŒ in their names.”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K­hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hjp h²hh³hÇh´Nubhþ)�”}”(hŒ–Another useful option for ``git log`` is ``-G``, which allows you to filter on certain strings appearing in the diffs of the commits you are listing::”h]”(hŒAnother useful option for ”…”�”}”(hju h²hh³Nh´Nubj')�”}”(hŒ ``git log``”h]”hŒgit log”…”�”}”(hj} h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hju ubhŒ is ”…”�”}”(hju h²hh³Nh´Nubj')�”}”(hŒ``-G``”h]”hŒ-G”…”�”}”(hj� h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hju ubhŒf, which allows you to filter on certain strings appearing in the diffs of the commits you are listing:”…”�”}”(hju h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Kµhjp h²hubjÖ)�”}”(hŒ+git log -G'regex' HEAD..^ -- ”h]”hŒ+git log -G'regex' HEAD..^ -- ”…”�”}”hj§ sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´K¹hjp h²hubhþ)�”}”(hXThis can also be a handy way to quickly find when something (e.g. a function call or a variable) was changed, added, or removed. The search string is a regular expression, which means you can potentially search for more specific things like assignments to a specific struct member::”h]”hXThis can also be a handy way to quickly find when something (e.g. a function call or a variable) was changed, added, or removed. The search string is a regular expression, which means you can potentially search for more specific things like assignments to a specific struct member:”…”�”}”(hjµ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´K»hjp h²hubjÖ)�”}”(hŒgit log -G'\->index\>.*='”h]”hŒgit log -G'\->index\>.*='”…”�”}”hjà sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´KÀhjp h²hubeh}”(h]”jØah ]”h"]”Œgit log”ah$]”h&]”uh1hÈhj1 h²hh³hÇh´K›ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ git blame”h]”hŒ git blame”…”�”}”(hjÛ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjØ h²hh³hÇh´KÃubhþ)�”}”(hXAnother way to find prerequisite commits (albeit only the most recent one for a given conflict) is to run ``git blame``. In this case, you need to run it against the parent commit of the patch you are cherry-picking and the file where the conflict appeared, i.e.::”h]”(hŒjAnother way to find prerequisite commits (albeit only the most recent one for a given conflict) is to run ”…”�”}”(hjé h²hh³Nh´Nubj')�”}”(hŒ ``git blame``”h]”hŒ git blame”…”�”}”(hjñ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjé ubhŒ�. In this case, you need to run it against the parent commit of the patch you are cherry-picking and the file where the conflict appeared, i.e.:”…”�”}”(hjé h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´KÅhjØ h²hubjÖ)�”}”(hŒgit blame ^ -- ”h]”hŒgit blame ^ -- ”…”�”}”hj sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´KÊhjØ h²hubhþ)�”}”(hŒ¯This command also accepts the ``-L`` argument (for restricting the output to a single function), but in this case you specify the filename at the end of the command as usual::”h]”(hŒThis command also accepts the ”…”�”}”(hj h²hh³Nh´Nubj')�”}”(hŒ``-L``”h]”hŒ-L”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj ubhŒŠ argument (for restricting the output to a single function), but in this case you specify the filename at the end of the command as usual:”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´KÌhjØ h²hubjÖ)�”}”(hŒ/git blame -L:'\' ^ -- ”h]”hŒ/git blame -L:'\' ^ -- ”…”�”}”hj7 sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´KÐhjØ h²hubhþ)�”}”(hŒ–Navigate to the place where the conflict occurred. The first column of the blame output is the commit ID of the patch that added a given line of code.”h]”hŒ–Navigate to the place where the conflict occurred. The first column of the blame output is the commit ID of the patch that added a given line of code.”…”�”}”(hjE h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´KÒhjØ h²hubhþ)�”}”(hXIt might be a good idea to ``git show`` these commits and see if they look like they might be the source of the conflict. Sometimes there will be more than one of these commits, either because multiple commits changed different lines of the same conflict area *or* because multiple subsequent patches changed the same line (or lines) multiple times. In the latter case, you may have to run ``git blame`` again and specify the older version of the file to look at in order to dig further back in the history of the file.”h]”(hŒIt might be a good idea to ”…”�”}”(hjS h²hh³Nh´Nubj')�”}”(hŒ ``git show``”h]”hŒgit show”…”�”}”(hj[ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjS ubhŒÝ these commits and see if they look like they might be the source of the conflict. Sometimes there will be more than one of these commits, either because multiple commits changed different lines of the same conflict area ”…”�”}”(hjS h²hh³Nh´Nubj�)�”}”(hŒ*or*”h]”hŒor”…”�”}”(hjm h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒhjS ubhŒ~ because multiple subsequent patches changed the same line (or lines) multiple times. In the latter case, you may have to run ”…”�”}”(hjS h²hh³Nh´Nubj')�”}”(hŒ ``git blame``”h]”hŒ git blame”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjS ubhŒt again and specify the older version of the file to look at in order to dig further back in the history of the file.”…”�”}”(hjS h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´KÖhjØ h²hubeh}”(h]”júah ]”h"]”Œ git blame”ah$]”h&]”uh1hÈhj1 h²hh³hÇh´KÃubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ#Prerequisite vs. incidental patches”h]”hŒ#Prerequisite vs. incidental patches”…”�”}”(hj¡ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjž h²hh³hÇh´Kàubhþ)�”}”(hXèHaving found the patch that caused the conflict, you need to determine whether it is a prerequisite for the patch you are backporting or whether it is just incidental and can be skipped. An incidental patch would be one that touches the same code as the patch you are backporting, but does not change the semantics of the code in any material way. For example, a whitespace cleanup patch is completely incidental -- likewise, a patch that simply renames a function or a variable would be incidental as well. On the other hand, if the function being changed does not even exist in your current branch then this would not be incidental at all and you need to carefully consider whether the patch adding the function should be cherry-picked first.”h]”hXèHaving found the patch that caused the conflict, you need to determine whether it is a prerequisite for the patch you are backporting or whether it is just incidental and can be skipped. An incidental patch would be one that touches the same code as the patch you are backporting, but does not change the semantics of the code in any material way. For example, a whitespace cleanup patch is completely incidental -- likewise, a patch that simply renames a function or a variable would be incidental as well. On the other hand, if the function being changed does not even exist in your current branch then this would not be incidental at all and you need to carefully consider whether the patch adding the function should be cherry-picked first.”…”�”}”(hj¯ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Kâhjž h²hubhþ)�”}”(hŒøIf you find that there is a necessary prerequisite patch, then you need to stop and cherry-pick that instead. If you've already resolved some conflicts in a different file and don't want to do it again, you can create a temporary copy of that file.”h]”hŒüIf you find that there is a necessary prerequisite patch, then you need to stop and cherry-pick that instead. If you’ve already resolved some conflicts in a different file and don’t want to do it again, you can create a temporary copy of that file.”…”�”}”(hj½ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Kîhjž h²hubhþ)�”}”(hŒ­To abort the current cherry-pick, go ahead and run ``git cherry-pick --abort``, then restart the cherry-picking process with the commit ID of the prerequisite patch instead.”h]”(hŒ3To abort the current cherry-pick, go ahead and run ”…”�”}”(hjË h²hh³Nh´Nubj')�”}”(hŒ``git cherry-pick --abort``”h]”hŒgit cherry-pick --abort”…”�”}”(hjÓ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjË ubhŒ_, then restart the cherry-picking process with the commit ID of the prerequisite patch instead.”…”�”}”(hjË h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Kóhjž h²hubeh}”(h]”jah ]”h"]”Œ#prerequisite vs. incidental patches”ah$]”h&]”uh1hÈhj1 h²hh³hÇh´Kàubeh}”(h]”j¹ah ]”h"]”Œprerequisite patches”ah$]”h&]”uh1hÈhjh²hh³hÇh´K‰ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒUnderstanding conflict markers”h]”hŒUnderstanding conflict markers”…”�”}”(hjü h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjù h²hh³hÇh´KøubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒCombined diffs”h]”hŒCombined diffs”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj h²hh³hÇh´Kûubhþ)�”}”(hŒÝLet's say you've decided against picking (or reverting) additional patches and you just want to resolve the conflict. Git will have inserted conflict markers into your file. Out of the box, this will look something like::”h]”hŒàLet’s say you’ve decided against picking (or reverting) additional patches and you just want to resolve the conflict. Git will have inserted conflict markers into your file. Out of the box, this will look something like:”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Kýhj h²hubjÖ)�”}”(hŒ£<<<<<<< HEAD this is what's in your current tree before cherry-picking ======= this is what the patch wants it to be after cherry-picking >>>>>>> ... title”h]”hŒ£<<<<<<< HEAD this is what's in your current tree before cherry-picking ======= this is what the patch wants it to be after cherry-picking >>>>>>> ... title”…”�”}”hj) sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´Mhj h²hubhþ)�”}”(hŒ­This is what you would see if you opened the file in your editor. However, if you were to run ``git diff`` without any arguments, the output would look something like this::”h]”(hŒ^This is what you would see if you opened the file in your editor. However, if you were to run ”…”�”}”(hj7 h²hh³Nh´Nubj')�”}”(hŒ ``git diff``”h]”hŒgit diff”…”�”}”(hj? h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj7 ubhŒB without any arguments, the output would look something like this:”…”�”}”(hj7 h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Mhj h²hubjÖ)�”}”(hŒÁ$ git diff [...] ++<<<<<<<< HEAD +this is what's in your current tree before cherry-picking ++======== + this is what the patch wants it to be after cherry-picking ++>>>>>>>> ... title”h]”hŒÁ$ git diff [...] ++<<<<<<<< HEAD +this is what's in your current tree before cherry-picking ++======== + this is what the patch wants it to be after cherry-picking ++>>>>>>>> ... title”…”�”}”hjW sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´M hj h²hubhþ)�”}”(hXWhen you are resolving a conflict, the behavior of ``git diff`` differs from its normal behavior. Notice the two columns of diff markers instead of the usual one; this is a so-called "`combined diff`_", here showing the 3-way diff (or diff-of-diffs) between”h]”(hŒ3When you are resolving a conflict, the behavior of ”…”�”}”(hje h²hh³Nh´Nubj')�”}”(hŒ ``git diff``”h]”hŒgit diff”…”�”}”(hjm h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hje ubhŒ{ differs from its normal behavior. Notice the two columns of diff markers instead of the usual one; this is a so-called “”…”�”}”(hje h²hh³Nh´Nubj)�”}”(hŒ`combined diff`_”h]”hŒ combined diff”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œ combined diff”jþŒ:https://git-scm.com/docs/diff-format#_combined_diff_format”uh1jhje jKubhŒ;â€�, here showing the 3-way diff (or diff-of-diffs) between”…”�”}”(hje h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Mhj h²hubhŒenumerated_list”“”)�”}”(hhh]”(j@)�”}”(hŒQthe current branch (before cherry-picking) and the current working directory, and”h]”hþ)�”}”(hŒQthe current branch (before cherry-picking) and the current working directory, and”h]”hŒQthe current branch (before cherry-picking) and the current working directory, and”…”�”}”(hj£ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MhjŸ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjœ h²hh³hÇh´Nubj@)�”}”(hŒothe current branch (before cherry-picking) and the file as it looks after the original patch has been applied. ”h]”hþ)�”}”(hŒnthe current branch (before cherry-picking) and the file as it looks after the original patch has been applied.”h]”hŒnthe current branch (before cherry-picking) and the file as it looks after the original patch has been applied.”…”�”}”(hj» h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Mhj· ubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjœ h²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œarabic”Œprefix”hŒsuffix”Œ.”uh1jš hj h²hh³hÇh´Mubj�)�”}”(hŒM.. _combined diff: https://git-scm.com/docs/diff-format#_combined_diff_format”h]”h}”(h]”Œ combined-diff”ah ]”h"]”Œ combined diff”ah$]”h&]”jþj� uh1jŒh´Mhj h²hh³hÇjšKubeh}”(h]”jiah ]”h"]”Œcombined diffs”ah$]”h&]”uh1hÈhjù h²hh³hÇh´KûubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ Better diffs”h]”hŒ Better diffs”…”�”}”(hjð h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjí h²hh³hÇh´M"ubhþ)�”}”(hX 3-way combined diffs include all the other changes that happened to the file between your current branch and the branch you are cherry-picking from. While this is useful for spotting other changes that you need to take into account, this also makes the output of ``git diff`` somewhat intimidating and difficult to read. You may instead prefer to run ``git diff HEAD`` (or ``git diff --ours``) which shows only the diff between the current branch before cherry-picking and the current working directory. It looks like this::”h]”(hX3-way combined diffs include all the other changes that happened to the file between your current branch and the branch you are cherry-picking from. While this is useful for spotting other changes that you need to take into account, this also makes the output of ”…”�”}”(hjþ h²hh³Nh´Nubj')�”}”(hŒ ``git diff``”h]”hŒgit diff”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjþ ubhŒL somewhat intimidating and difficult to read. You may instead prefer to run ”…”�”}”(hjþ h²hh³Nh´Nubj')�”}”(hŒ``git diff HEAD``”h]”hŒ git diff HEAD”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjþ ubhŒ (or ”…”�”}”(hjþ h²hh³Nh´Nubj')�”}”(hŒ``git diff --ours``”h]”hŒgit diff --ours”…”�”}”(hj* h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjþ ubhŒƒ) which shows only the diff between the current branch before cherry-picking and the current working directory. It looks like this:”…”�”}”(hjþ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M$hjí h²hubjÖ)�”}”(hŒÁ$ git diff HEAD [...] +<<<<<<<< HEAD this is what's in your current tree before cherry-picking +======== +this is what the patch wants it to be after cherry-picking +>>>>>>>> ... title”h]”hŒÁ$ git diff HEAD [...] +<<<<<<<< HEAD this is what's in your current tree before cherry-picking +======== +this is what the patch wants it to be after cherry-picking +>>>>>>>> ... title”…”�”}”hjB sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´M-hjí h²hubhþ)�”}”(hŒÚAs you can see, this reads just like any other diff and makes it clear which lines are in the current branch and which lines are being added because they are part of the merge conflict or the patch being cherry-picked.”h]”hŒÚAs you can see, this reads just like any other diff and makes it clear which lines are in the current branch and which lines are being added because they are part of the merge conflict or the patch being cherry-picked.”…”�”}”(hjP h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M5hjí h²hubeh}”(h]”j‹ah ]”h"]”Œ better diffs”ah$]”h&]”uh1hÈhjù h²hh³hÇh´M"ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒMerge styles and diff3”h]”hŒMerge styles and diff3”…”�”}”(hjh h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhje h²hh³hÇh´M;ubhþ)�”}”(hŒ«The default conflict marker style shown above is known as the ``merge`` style. There is also another style available, known as the ``diff3`` style, which looks like this::”h]”(hŒ>The default conflict marker style shown above is known as the ”…”�”}”(hjv h²hh³Nh´Nubj')�”}”(hŒ ``merge``”h]”hŒmerge”…”�”}”(hj~ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjv ubhŒ< style. There is also another style available, known as the ”…”�”}”(hjv h²hh³Nh´Nubj')�”}”(hŒ ``diff3``”h]”hŒdiff3”…”�”}”(hj� h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjv ubhŒ style, which looks like this:”…”�”}”(hjv h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M=hje h²hubjÖ)�”}”(hŒó<<<<<<< HEAD this is what is in your current tree before cherry-picking ||||||| parent of (title) this is what the patch expected to find there ======= this is what the patch wants it to be after being applied >>>>>>> (title)”h]”hŒó<<<<<<< HEAD this is what is in your current tree before cherry-picking ||||||| parent of (title) this is what the patch expected to find there ======= this is what the patch wants it to be after being applied >>>>>>> (title)”…”�”}”hj¨ sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´MAhje h²hubhþ)�”}”(hX–As you can see, this has 3 parts instead of 2, and includes what git expected to find there but didn't. It is *highly recommended* to use this conflict style as it makes it much clearer what the patch actually changed; i.e., it allows you to compare the before-and-after versions of the file for the commit you are cherry-picking. This allows you to make better decisions about how to resolve the conflict.”h]”(hŒpAs you can see, this has 3 parts instead of 2, and includes what git expected to find there but didn’t. It is ”…”�”}”(hj¶ h²hh³Nh´Nubj�)�”}”(hŒ*highly recommended*”h]”hŒhighly recommended”…”�”}”(hj¾ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒhj¶ ubhX to use this conflict style as it makes it much clearer what the patch actually changed; i.e., it allows you to compare the before-and-after versions of the file for the commit you are cherry-picking. This allows you to make better decisions about how to resolve the conflict.”…”�”}”(hj¶ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MIhje h²hubhþ)�”}”(hŒETo change conflict marker styles, you can use the following command::”h]”hŒDTo change conflict marker styles, you can use the following command:”…”�”}”(hjÖ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MPhje h²hubjÖ)�”}”(hŒ$git config merge.conflictStyle diff3”h]”hŒ$git config merge.conflictStyle diff3”…”�”}”hjä sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´MRhje h²hubhþ)�”}”(hŒÉThere is a third option, ``zdiff3``, introduced in `Git 2.35`_, which has the same 3 sections as ``diff3``, but where common lines have been trimmed off, making the conflict area smaller in some cases.”h]”(hŒThere is a third option, ”…”�”}”(hjò h²hh³Nh´Nubj')�”}”(hŒ ``zdiff3``”h]”hŒzdiff3”…”�”}”(hjú h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjò ubhŒ, introduced in ”…”�”}”(hjò h²hh³Nh´Nubj)�”}”(hŒ `Git 2.35`_”h]”hŒGit 2.35”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒGit 2.35”jþŒ8https://github.blog/2022-01-24-highlights-from-git-2-35/”uh1jhjò jKubhŒ#, which has the same 3 sections as ”…”�”}”(hjò h²hh³Nh´Nubj')�”}”(hŒ ``diff3``”h]”hŒdiff3”…”�”}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjò ubhŒ_, but where common lines have been trimmed off, making the conflict area smaller in some cases.”…”�”}”(hjò h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MThje h²hubj�)�”}”(hŒF.. _Git 2.35: https://github.blog/2022-01-24-highlights-from-git-2-35/”h]”h}”(h]”Œgit-2-35”ah ]”h"]”Œgit 2.35”ah$]”h&]”jþjuh1jŒh´MXhje h²hh³hÇjšKubeh}”(h]”j­ah ]”h"]”Œmerge styles and diff3”ah$]”h&]”uh1hÈhjù h²hh³hÇh´M;ubeh}”(h]”jJah ]”h"]”Œunderstanding conflict markers”ah$]”h&]”uh1hÈhjh²hh³hÇh´KøubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ!Iterating on conflict resolutions”h]”hŒ!Iterating on conflict resolutions”…”�”}”(hjVh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjSh²hh³hÇh´M[ubhþ)�”}”(hXThe first step in any conflict resolution process is to understand the patch you are backporting. For the Linux kernel this is especially important, since an incorrect change can lead to the whole system crashing -- or worse, an undetected security vulnerability.”h]”hXThe first step in any conflict resolution process is to understand the patch you are backporting. For the Linux kernel this is especially important, since an incorrect change can lead to the whole system crashing -- or worse, an undetected security vulnerability.”…”�”}”(hjdh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M]hjSh²hubhþ)�”}”(hXGUnderstanding the patch can be easy or difficult depending on the patch itself, the changelog, and your familiarity with the code being changed. However, a good question for every change (or every hunk of the patch) might be: "Why is this hunk in the patch?" The answers to these questions will inform your conflict resolution.”h]”hXKUnderstanding the patch can be easy or difficult depending on the patch itself, the changelog, and your familiarity with the code being changed. However, a good question for every change (or every hunk of the patch) might be: “Why is this hunk in the patch?â€� The answers to these questions will inform your conflict resolution.”…”�”}”(hjrh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MbhjSh²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒResolution process”h]”hŒResolution process”…”�”}”(hjƒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj€h²hh³hÇh´Miubhþ)�”}”(hXwSometimes the easiest thing to do is to just remove all but the first part of the conflict, leaving the file essentially unchanged, and apply the changes by hand. Perhaps the patch is changing a function call argument from ``0`` to ``1`` while a conflicting change added an entirely new (and insignificant) parameter to the end of the parameter list; in that case, it's easy enough to change the argument from ``0`` to ``1`` by hand and leave the rest of the arguments alone. This technique of manually applying changes is mostly useful if the conflict pulled in a lot of unrelated context that you don't really need to care about.”h]”(hŒßSometimes the easiest thing to do is to just remove all but the first part of the conflict, leaving the file essentially unchanged, and apply the changes by hand. Perhaps the patch is changing a function call argument from ”…”�”}”(hj‘h²hh³Nh´Nubj')�”}”(hŒ``0``”h]”hŒ0”…”�”}”(hj™h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj‘ubhŒ to ”…”�”}”(hj‘h²hh³Nh´Nubj')�”}”(hŒ``1``”h]”hŒ1”…”�”}”(hj«h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj‘ubhŒ¯ while a conflicting change added an entirely new (and insignificant) parameter to the end of the parameter list; in that case, it’s easy enough to change the argument from ”…”�”}”(hj‘h²hh³Nh´Nubj')�”}”(hŒ``0``”h]”hŒ0”…”�”}”(hj½h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj‘ubhŒ to ”…”�”}”(hj‘h²hh³Nh´Nubj')�”}”(hŒ``1``”h]”hŒ1”…”�”}”(hjÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj‘ubhŒÑ by hand and leave the rest of the arguments alone. This technique of manually applying changes is mostly useful if the conflict pulled in a lot of unrelated context that you don’t really need to care about.”…”�”}”(hj‘h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Mkhj€h²hubhþ)�”}”(hX>For particularly nasty conflicts with many conflict markers, you can use ``git add`` or ``git add -i`` to selectively stage your resolutions to get them out of the way; this also lets you use ``git diff HEAD`` to always see what remains to be resolved or ``git diff --cached`` to see what your patch looks like so far.”h]”(hŒIFor particularly nasty conflicts with many conflict markers, you can use ”…”�”}”(hjçh²hh³Nh´Nubj')�”}”(hŒ ``git add``”h]”hŒgit add”…”�”}”(hjïh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjçubhŒ or ”…”�”}”(hjçh²hh³Nh´Nubj')�”}”(hŒ``git add -i``”h]”hŒ git add -i”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjçubhŒZ to selectively stage your resolutions to get them out of the way; this also lets you use ”…”�”}”(hjçh²hh³Nh´Nubj')�”}”(hŒ``git diff HEAD``”h]”hŒ git diff HEAD”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjçubhŒ. to always see what remains to be resolved or ”…”�”}”(hjçh²hh³Nh´Nubj')�”}”(hŒ``git diff --cached``”h]”hŒgit diff --cached”…”�”}”(hj%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjçubhŒ* to see what your patch looks like so far.”…”�”}”(hjçh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Mvhj€h²hubeh}”(h]”júah ]”h"]”Œresolution process”ah$]”h&]”uh1hÈhjSh²hh³hÇh´MiubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒDealing with file renames”h]”hŒDealing with file renames”…”�”}”(hjGh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjDh²hh³hÇh´M}ubhþ)�”}”(hX*One of the most annoying things that can happen while backporting a patch is discovering that one of the files being patched has been renamed, as that typically means git won't even put in conflict markers, but will just throw up its hands and say (paraphrased): "Unmerged path! You do the work..."”h]”hX0One of the most annoying things that can happen while backporting a patch is discovering that one of the files being patched has been renamed, as that typically means git won’t even put in conflict markers, but will just throw up its hands and say (paraphrased): “Unmerged path! You do the work...â€�”…”�”}”(hjUh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MhjDh²hubhþ)�”}”(hX0There are generally a few ways to deal with this. If the patch to the renamed file is small, like a one-line change, the easiest thing is to just go ahead and apply the change by hand and be done with it. On the other hand, if the change is big or complicated, you definitely don't want to do it by hand.”h]”hX2There are generally a few ways to deal with this. If the patch to the renamed file is small, like a one-line change, the easiest thing is to just go ahead and apply the change by hand and be done with it. On the other hand, if the change is big or complicated, you definitely don’t want to do it by hand.”…”�”}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M…hjDh²hubhþ)�”}”(hXAs a first pass, you can try something like this, which will lower the rename detection threshold to 30% (by default, git uses 50%, meaning that two files need to have at least 50% in common for it to consider an add-delete pair to be a potential rename)::”h]”hŒÿAs a first pass, you can try something like this, which will lower the rename detection threshold to 30% (by default, git uses 50%, meaning that two files need to have at least 50% in common for it to consider an add-delete pair to be a potential rename):”…”�”}”(hjqh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M‹hjDh²hubjÖ)�”}”(hŒ9git cherry-pick -strategy=recursive -Xrename-threshold=30”h]”hŒ9git cherry-pick -strategy=recursive -Xrename-threshold=30”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´M�hjDh²hubhþ)�”}”(hXSometimes the right thing to do will be to also backport the patch that did the rename, but that's definitely not the most common case. Instead, what you can do is to temporarily rename the file in the branch you're backporting to (using ``git mv`` and committing the result), restart the attempt to cherry-pick the patch, rename the file back (``git mv`` and committing again), and finally squash the result using ``git rebase -i`` (see the `rebase tutorial`_) so it appears as a single commit when you are done.”h]”(hŒòSometimes the right thing to do will be to also backport the patch that did the rename, but that’s definitely not the most common case. Instead, what you can do is to temporarily rename the file in the branch you’re backporting to (using ”…”�”}”(hj�h²hh³Nh´Nubj')�”}”(hŒ ``git mv``”h]”hŒgit mv”…”�”}”(hj•h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj�ubhŒa and committing the result), restart the attempt to cherry-pick the patch, rename the file back (”…”�”}”(hj�h²hh³Nh´Nubj')�”}”(hŒ ``git mv``”h]”hŒgit mv”…”�”}”(hj§h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj�ubhŒ< and committing again), and finally squash the result using ”…”�”}”(hj�h²hh³Nh´Nubj')�”}”(hŒ``git rebase -i``”h]”hŒ git rebase -i”…”�”}”(hj¹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj�ubhŒ (see the ”…”�”}”(hj�h²hh³Nh´Nubj)�”}”(hŒ`rebase tutorial`_”h]”hŒrebase tutorial”…”�”}”(hjËh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œrebase tutorial”jþŒehttps://medium.com/@slamflipstrom/a-beginners-guide-to-squashing-commits-with-git-rebase-8185cf6e62ec”uh1jhj�jKubhŒ5) so it appears as a single commit when you are done.”…”�”}”(hj�h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M’hjD•bvh²hubj�)�”}”(hŒz.. _rebase tutorial: https://medium.com/@slamflipstrom/a-beginners-guide-to-squashing-commits-with-git-rebase-8185cf6e62ec”h]”h}”(h]”Œrebase-tutorial”ah ]”h"]”Œrebase tutorial”ah$]”h&]”jþjÛuh1jŒh´M›hjDh²hh³hÇjšKubeh}”(h]”jah ]”h"]”Œdealing with file renames”ah$]”h&]”uh1hÈhjSh²hh³hÇh´M}ubeh}”(h]”jÛah ]”h"]”Œ!iterating on conflict resolutions”ah$]”h&]”uh1hÈhjh²hh³hÇh´M[ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒGotchas”h]”hŒGotchas”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´MžubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒFunction arguments”h]”hŒFunction arguments”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´M¡ubhþ)�”}”(hX/Pay attention to changing function arguments! It's easy to gloss over details and think that two lines are the same but actually they differ in some small detail like which variable was passed as an argument (especially if the two variables are both a single character that look the same, like i and j).”h]”hX1Pay attention to changing function arguments! It’s easy to gloss over details and think that two lines are the same but actually they differ in some small detail like which variable was passed as an argument (especially if the two variables are both a single character that look the same, like i and j).”…”�”}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M£hjh²hubeh}”(h]”jiah ]”h"]”Œfunction arguments”ah$]”h&]”uh1hÈhjh²hh³hÇh´M¡ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒError handling”h]”hŒError handling”…”�”}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj7h²hh³hÇh´Mªubhþ)�”}”(hX"If you cherry-pick a patch that includes a ``goto`` statement (typically for error handling), it is absolutely imperative to double check that the target label is still correct in the branch you are backporting to. The same goes for added ``return``, ``break``, and ``continue`` statements.”h]”(hŒ+If you cherry-pick a patch that includes a ”…”�”}”(hjHh²hh³Nh´Nubj')�”}”(hŒ``goto``”h]”hŒgoto”…”�”}”(hjPh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjHubhŒ¼ statement (typically for error handling), it is absolutely imperative to double check that the target label is still correct in the branch you are backporting to. The same goes for added ”…”�”}”(hjHh²hh³Nh´Nubj')�”}”(hŒ ``return``”h]”hŒreturn”…”�”}”(hjbh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjHubhŒ, ”…”�”}”(hjHh²hh³Nh´Nubj')�”}”(hŒ ``break``”h]”hŒbreak”…”�”}”(hjth²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjHubhŒ, and ”…”�”}”(hjHh²hh³Nh´Nubj')�”}”(hŒ ``continue``”h]”hŒcontinue”…”�”}”(hj†h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjHubhŒ statements.”…”�”}”(hjHh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M¬hj7h²hubhþ)�”}”(hŒ¡Error handling is typically located at the bottom of the function, so it may not be part of the conflict even though it could have been changed by other patches.”h]”hŒ¡Error handling is typically located at the bottom of the function, so it may not be part of the conflict even though it could have been changed by other patches.”…”�”}”(hjžh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M²hj7h²hubhþ)�”}”(hX"A good way to ensure that you review the error paths is to always use ``git diff -W`` and ``git show -W`` (AKA ``--function-context``) when inspecting your changes. For C code, this will show you the whole function that's being changed in a patch. One of the things that often go wrong during backports is that something else in the function changed on either of the branches that you're backporting from or to. By including the whole function in the diff you get more context and can more easily spot problems that might otherwise go unnoticed.”h]”(hŒFA good way to ensure that you review the error paths is to always use ”…”�”}”(hj¬h²hh³Nh´Nubj')�”}”(hŒ``git diff -W``”h]”hŒ git diff -W”…”�”}”(hj´h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj¬ubhŒ and ”…”�”}”(hj¬h²hh³Nh´Nubj')�”}”(hŒ``git show -W``”h]”hŒ git show -W”…”�”}”(hjÆh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj¬ubhŒ (AKA ”…”�”}”(hj¬h²hh³Nh´Nubj')�”}”(hŒ``--function-context``”h]”hŒ--function-context”…”�”}”(hjØh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj¬ubhX¡) when inspecting your changes. For C code, this will show you the whole function that’s being changed in a patch. One of the things that often go wrong during backports is that something else in the function changed on either of the branches that you’re backporting from or to. By including the whole function in the diff you get more context and can more easily spot problems that might otherwise go unnoticed.”…”�”}”(hj¬h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M¶hj7h²hubeh}”(h]”j‹ah ]”h"]”Œerror handling”ah$]”h&]”uh1hÈhjh²hh³hÇh´MªubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒRefactored code”h]”hŒRefactored code”…”�”}”(hjúh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj÷h²hh³hÇh´MÀubhþ)�”}”(hXÛSomething that happens quite often is that code gets refactored by "factoring out" a common code sequence or pattern into a helper function. When backporting patches to an area where such a refactoring has taken place, you effectively need to do the reverse when backporting: a patch to a single location may need to be applied to multiple locations in the backported version. (One giveaway for this scenario is that a function was renamed -- but that's not always the case.)”h]”hXáSomething that happens quite often is that code gets refactored by “factoring outâ€� a common code sequence or pattern into a helper function. When backporting patches to an area where such a refactoring has taken place, you effectively need to do the reverse when backporting: a patch to a single location may need to be applied to multiple locations in the backported version. (One giveaway for this scenario is that a function was renamed -- but that’s not always the case.)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MÂhj÷h²hubhþ)�”}”(hX5To avoid incomplete backports, it's worth trying to figure out if the patch fixes a bug that appears in more than one place. One way to do this would be to use ``git grep``. (This is actually a good idea to do in general, not just for backports.) If you do find that the same kind of fix would apply to other places, it's also worth seeing if those places exist upstream -- if they don't, it's likely the patch may need to be adjusted. ``git log`` is your friend to figure out what happened to these areas as ``git blame`` won't show you code that has been removed.”h]”(hŒ¢To avoid incomplete backports, it’s worth trying to figure out if the patch fixes a bug that appears in more than one place. One way to do this would be to use ”…”�”}”(hjh²hh³Nh´Nubj')�”}”(hŒ ``git grep``”h]”hŒgit grep”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjubhX. (This is actually a good idea to do in general, not just for backports.) If you do find that the same kind of fix would apply to other places, it’s also worth seeing if those places exist upstream -- if they don’t, it’s likely the patch may need to be adjusted. ”…”�”}”(hjh²hh³Nh´Nubj')�”}”(hŒ ``git log``”h]”hŒgit log”…”�”}”(hj0h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjubhŒ> is your friend to figure out what happened to these areas as ”…”�”}”(hjh²hh³Nh´Nubj')�”}”(hŒ ``git blame``”h]”hŒ git blame”…”�”}”(hjBh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjubhŒ- won’t show you code that has been removed.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MËhj÷h²hubhþ)�”}”(hŒÔIf you do find other instances of the same pattern in the upstream tree and you're not sure whether it's also a bug, it may be worth asking the patch author. It's not uncommon to find new bugs during backporting!”h]”hŒÚIf you do find other instances of the same pattern in the upstream tree and you’re not sure whether it’s also a bug, it may be worth asking the patch author. It’s not uncommon to find new bugs during backporting!”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MÕhj÷h²hubeh}”(h]”j­ah ]”h"]”Œrefactored code”ah$]”h&]”uh1hÈhjh²hh³hÇh´MÀubeh}”(h]”jJah ]”h"]”Œgotchas”ah$]”h&]”uh1hÈhjh²hh³hÇh´Mžubeh}”(h]”jšah ]”h"]”Œresolving conflicts”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KWubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒVerifying the result”h]”hŒVerifying the result”…”�”}”(hj€h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj}h²hh³hÇh´MÚubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ colordiff”h]”hŒ colordiff”…”�”}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjŽh²hh³hÇh´MÝubhþ)�”}”(hŒÿHaving committed a conflict-free new patch, you can now compare your patch to the original patch. It is highly recommended that you use a tool such as `colordiff`_ that can show two files side by side and color them according to the changes between them::”h]”(hŒ—Having committed a conflict-free new patch, you can now compare your patch to the original patch. It is highly recommended that you use a tool such as ”…”�”}”(hjŸh²hh³Nh´Nubj)�”}”(hŒ `colordiff`_”h]”hŒ colordiff”…”�”}”(hj§h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œ colordiff”jþŒhttps://www.colordiff.org/”uh1jhjŸjKubhŒ[ that can show two files side by side and color them according to the changes between them:”…”�”}”(hjŸh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MßhjŽh²hubjÖ)�”}”(hŒXcolordiff -yw -W 200 <(git diff -W ^-) <(git diff -W HEAD^-) | less -SR”h]”hŒXcolordiff -yw -W 200 <(git diff -W ^-) <(git diff -W HEAD^-) | less -SR”…”�”}”hjÂsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´MähjŽh²hubj�)�”}”(hŒ).. _colordiff: https://www.colordiff.org/”h]”h}”(h]”Œid1”ah ]”h"]”Œ colordiff”ah$]”h&]”jþj·uh1jŒh´MæhjŽh²hh³hÇjšKubhþ)�”}”(hŒÆHere, ``-y`` means to do a side-by-side comparison; ``-w`` ignores whitespace, and ``-W 200`` sets the width of the output (as otherwise it will use 130 by default, which is often a bit too little).”h]”(hŒHere, ”…”�”}”(hjÜh²hh³Nh´Nubj')�”}”(hŒ``-y``”h]”hŒ-y”…”�”}”(hjäh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjÜubhŒ( means to do a side-by-side comparison; ”…”�”}”(hjÜh²hh³Nh´Nubj')�”}”(hŒ``-w``”h]”hŒ-w”…”�”}”(hjöh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjÜubhŒ ignores whitespace, and ”…”�”}”(hjÜh²hh³Nh´Nubj')�”}”(hŒ ``-W 200``”h]”hŒ-W 200”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjÜubhŒi sets the width of the output (as otherwise it will use 130 by default, which is often a bit too little).”…”�”}”(hjÜh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MèhjŽh²hubhþ)�”}”(hŒ¯The ``rev^-`` syntax is a handy shorthand for ``rev^..rev``, essentially giving you just the diff for that single commit; also see the official `git rev-parse documentation`_.”h]”(hŒThe ”…”�”}”(hj h²hh³Nh´Nubj')�”}”(hŒ ``rev^-``”h]”hŒrev^-”…”�”}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj ubhŒ! syntax is a handy shorthand for ”…”�”}”(hj h²hh³Nh´Nubj')�”}”(hŒ ``rev^..rev``”h]”hŒ rev^..rev”…”�”}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj ubhŒU, essentially giving you just the diff for that single commit; also see the official ”…”�”}”(hj h²hh³Nh´Nubj)�”}”(hŒ`git rev-parse documentation`_”h]”hŒgit rev-parse documentation”…”�”}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œgit rev-parse documentation”jþŒLhttps://git-scm.com/docs/git-rev-parse#_other_rev_parent_shorthand_notations”uh1jhj jKubhŒ.”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MìhjŽh²hubj�)�”}”(hŒm.. _git rev-parse documentation: https://git-scm.com/docs/git-rev-parse#_other_rev_parent_shorthand_notations”h]”h}”(h]”Œgit-rev-parse-documentation”ah ]”h"]”Œgit rev-parse documentation”ah$]”h&]”jþj\uh1jŒh´MðhjŽh²hh³hÇjšKubhþ)�”}”(hŒ‰Again, note the inclusion of ``-W`` for ``git diff``; this ensures that you will see the full function for any function that has changed.”h]”(hŒAgain, note the inclusion of ”…”�”}”(hjsh²hh³Nh´Nubj')�”}”(hŒ``-W``”h]”hŒ-W”…”�”}”(hj{h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjsubhŒ for ”…”�”}”(hjsh²hh³Nh´Nubj')�”}”(hŒ ``git diff``”h]”hŒgit diff”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjsubhŒU; this ensures that you will see the full function for any function that has changed.”…”�”}”(hjsh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MòhjŽh²hubhþ)�”}”(hXOne incredibly important thing that colordiff does is to highlight lines that are different. For example, if an error-handling ``goto`` has changed labels between the original and backported patch, colordiff will show these side-by-side but highlighted in a different color. Thus, it is easy to see that the two ``goto`` statements are jumping to different labels. Likewise, lines that were not modified by either patch but differ in the context will also be highlighted and thus stand out during a manual inspection.”h]”(hŒOne incredibly important thing that colordiff does is to highlight lines that are different. For example, if an error-handling ”…”�”}”(hj¥h²hh³Nh´Nubj')�”}”(hŒ``goto``”h]”hŒgoto”…”�”}”(hj­h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj¥ubhŒ² has changed labels between the original and backported patch, colordiff will show these side-by-side but highlighted in a different color. Thus, it is easy to see that the two ”…”�”}”(hj¥h²hh³Nh´Nubj')�”}”(hŒ``goto``”h]”hŒgoto”…”�”}”(hj¿h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hj¥ubhŒÅ statements are jumping to different labels. Likewise, lines that were not modified by either patch but differ in the context will also be highlighted and thus stand out during a manual inspection.”…”�”}”(hj¥h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MõhjŽh²hubhþ)�”}”(hŒsOf course, this is just a visual inspection; the real test is building and running the patched kernel (or program).”h]”hŒsOf course, this is just a visual inspection; the real test is building and running the patched kernel (or program).”…”�”}”(hj×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MþhjŽh²hubeh}”(h]”jah ]”h"]”h$]”jÙah&]”uh1hÈhj}h²hh³hÇh´MÝjšKubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ Build testing”h]”hŒ Build testing”…”�”}”(hjîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjëh²hh³hÇh´Mubhþ)�”}”(hX We won't cover runtime testing here, but it can be a good idea to build just the files touched by the patch as a quick sanity check. For the Linux kernel you can build single files like this, assuming you have the ``.config`` and build environment set up correctly::”h]”(hŒØWe won’t cover runtime testing here, but it can be a good idea to build just the files touched by the patch as a quick sanity check. For the Linux kernel you can build single files like this, assuming you have the ”…”�”}”(hjüh²hh³Nh´Nubj')�”}”(hŒ ``.config``”h]”hŒ.config”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjüubhŒ( and build environment set up correctly:”…”�”}”(hjüh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´Mhjëh²hubjÖ)�”}”(hŒmake path/to/file.o”h]”hŒmake path/to/file.o”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´M hjëh²hubhþ)�”}”(hXNote that this won't discover linker errors, so you should still do a full build after verifying that the single file compiles. By compiling the single file first you can avoid having to wait for a full build *in case* there are compiler errors in any of the files you've changed.”h]”(hŒÓNote that this won’t discover linker errors, so you should still do a full build after verifying that the single file compiles. By compiling the single file first you can avoid having to wait for a full build ”…”�”}”(hj*h²hh³Nh´Nubj�)�”}”(hŒ *in case*”h]”hŒin case”…”�”}”(hj2h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒhj*ubhŒ@ there are compiler errors in any of the files you’ve changed.”…”�”}”(hj*h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M hjëh²hubeh}”(h]”j(ah ]”h"]”Œ build testing”ah$]”h&]”uh1hÈhj}h²hh³hÇh´MubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒRuntime testing”h]”hŒRuntime testing”…”�”}”(hjTh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjQh²hh³hÇh´Mubhþ)�”}”(hX6Even a successful build or boot test is not necessarily enough to rule out a missing dependency somewhere. Even though the chances are small, there could be code changes where two independent changes to the same file result in no conflicts, no compile-time errors, and runtime errors only in exceptional cases.”h]”hX6Even a successful build or boot test is not necessarily enough to rule out a missing dependency somewhere. Even though the chances are small, there could be code changes where two independent changes to the same file result in no conflicts, no compile-time errors, and runtime errors only in exceptional cases.”…”�”}”(hjbh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MhjQh²hubhþ)�”}”(hX®One concrete example of this was a pair of patches to the system call entry code where the first patch saved/restored a register and a later patch made use of the same register somewhere in the middle of this sequence. Since there was no overlap between the changes, one could cherry-pick the second patch, have no conflicts, and believe that everything was fine, when in fact the code was now scribbling over an unsaved register.”h]”hX®One concrete example of this was a pair of patches to the system call entry code where the first patch saved/restored a register and a later patch made use of the same register somewhere in the middle of this sequence. Since there was no overlap between the changes, one could cherry-pick the second patch, have no conflicts, and believe that everything was fine, when in fact the code was now scribbling over an unsaved register.”…”�”}”(hjph²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MhjQh²hubhþ)�”}”(hX—Although the vast majority of errors will be caught during compilation or by superficially exercising the code, the only way to *really* verify a backport is to review the final patch with the same level of scrutiny as you would (or should) give to any other patch. Having unit tests and regression tests or other types of automatic testing can help increase the confidence in the correctness of a backport.”h]”(hŒ€Although the vast majority of errors will be caught during compilation or by superficially exercising the code, the only way to ”…”�”}”(hj~h²hh³Nh´Nubj�)�”}”(hŒ*really*”h]”hŒreally”…”�”}”(hj†h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒhj~ubhX verify a backport is to review the final patch with the same level of scrutiny as you would (or should) give to any other patch. Having unit tests and regression tests or other types of automatic testing can help increase the confidence in the correctness of a backport.”…”�”}”(hj~h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M!hjQh²hubeh}”(h]”jJah ]”h"]”Œruntime testing”ah$]”h&]”uh1hÈhj}h²hh³hÇh´Mubeh}”(h]”jçah ]”h"]”Œverifying the result”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´MÚubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒSubmitting backports to stable”h]”hŒSubmitting backports to stable”…”�”}”(hj¯h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj¬h²hh³hÇh´M)ubhþ)�”}”(hXnAs the stable maintainers try to cherry-pick mainline fixes onto their stable kernels, they may send out emails asking for backports when encountering conflicts, see e.g. . These emails typically include the exact steps you need to cherry-pick the patch to the correct tree and submit the patch.”h]”(hŒ¬As the stable maintainers try to cherry-pick mainline fixes onto their stable kernels, they may send out emails asking for backports when encountering conflicts, see e.g. <”…”�”}”(hj½h²hh³Nh´Nubj)�”}”(hŒEhttps://lore.kernel.org/stable/2023101528-jawed-shelving-071a@gregkh/”h]”hŒEhttps://lore.kernel.org/stable/2023101528-jawed-shelving-071a@gregkh/”…”�”}”(hjÅh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jÇuh1jhj½ubhŒ}>. These emails typically include the exact steps you need to cherry-pick the patch to the correct tree and submit the patch.”…”�”}”(hj½h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M+hj¬h²hubhþ)�”}”(hŒOOne thing to make sure is that your changelog conforms to the expected format::”h]”hŒNOne thing to make sure is that your changelog conforms to the expected format:”…”�”}”(hjÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M2hj¬h²hubjÖ)�”}”(hŒ¶ [ Upstream commit ] [ ] Signed-off-by: ”h]”hŒ¶ [ Upstream commit ] [ ] Signed-off-by: ”…”�”}”hjìsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´M5hj¬h²hubhþ)�”}”(hŒ|The "Upstream commit" line is sometimes slightly different depending on the stable version. Older version used this format::”h]”hŒThe “Upstream commitâ€� line is sometimes slightly different depending on the stable version. Older version used this format:”…”�”}”(hjúh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´M=hj¬h²hubjÖ)�”}”(hŒcommit upstream.”h]”hŒcommit upstream.”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÕh³hÇh´M@hj¬h²hubhþ)�”}”(hŒíIt is most common to indicate the kernel version the patch applies to in the email subject line (using e.g. ``git send-email --subject-prefix='PATCH 6.1.y'``), but you can also put it in the Signed-off-by:-area or below the ``---`` line.”h]”(hŒlIt is most common to indicate the kernel version the patch applies to in the email subject line (using e.g. ”…”�”}”(hjh²hh³Nh´Nubj')�”}”(hŒ1``git send-email --subject-prefix='PATCH 6.1.y'``”h]”hŒ-git send-email --subject-prefix='PATCH 6.1.y'”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjubhŒC), but you can also put it in the Signed-off-by:-area or below the ”…”�”}”(hjh²hh³Nh´Nubj')�”}”(hŒ``---``”h]”hŒ---”…”�”}”(hj0h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j&hjubhŒ line.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MBhj¬h²hubhþ)�”}”(hŒˆThe stable maintainers expect separate submissions for each active stable version, and each submission should also be tested separately.”h]”hŒˆThe stable maintainers expect separate submissions for each active stable version, and each submission should also be tested separately.”…”�”}”(hjHh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MGhj¬h²hubeh}”(h]”jxah ]”h"]”Œsubmitting backports to stable”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´M)ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒA few final words of advice”h]”hŒA few final words of advice”…”�”}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj]h²hh³hÇh´MKubj› )�”}”(hhh]”(j@)�”}”(hŒ/Approach the backporting process with humility.”h]”hþ)�”}”(hjsh]”hŒ/Approach the backporting process with humility.”…”�”}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MMhjqubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjnh²hh³hÇh´Nubj@)�”}”(hŒ]Understand the patch you are backporting; this means reading both the changelog and the code.”h]”hþ)�”}”(hŒ]Understand the patch you are backporting; this means reading both the changelog and the code.”h]”hŒ]Understand the patch you are backporting; this means reading both the changelog and the code.”…”�”}”(hjŒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MNhjˆubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjnh²hh³hÇh´Nubj@)�”}”(hŒHBe honest about your confidence in the result when submitting the patch.”h]”hþ)�”}”(hŒHBe honest about your confidence in the result when submitting the patch.”h]”hŒHBe honest about your confidence in the result when submitting the patch.”…”�”}”(hj¤h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MPhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjnh²hh³hÇh´Nubj@)�”}”(hŒ,Ask relevant maintainers for explicit acks. ”h]”hþ)�”}”(hŒ+Ask relevant maintainers for explicit acks.”h]”hŒ+Ask relevant maintainers for explicit acks.”…”�”}”(hj¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MRhj¸ubah}”(h]”h ]”h"]”h$]”h&]”uh1j?hjnh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jÕ jÖ j× hjØ Œ)”uh1jš hj]h²hh³hÇh´MMubeh}”(h]”jšah ]”h"]”Œa few final words of advice”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´MKubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒExamples”h]”hŒExamples”…”�”}”(hjáh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjÞh²hh³hÇh´MUubhþ)�”}”(hŒÙThe above shows roughly the idealized process of backporting a patch. For a more concrete example, see this video tutorial where two patches are backported from mainline to stable: `Backporting Linux Kernel Patches`_.”h]”(hŒµThe above shows roughly the idealized process of backporting a patch. For a more concrete example, see this video tutorial where two patches are backported from mainline to stable: ”…”�”}”(hjïh²hh³Nh´Nubj)�”}”(hŒ#`Backporting Linux Kernel Patches`_”h]”hŒ Backporting Linux Kernel Patches”…”�”}”(hj÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œ Backporting Linux Kernel Patches”jþŒhttps://youtu.be/sBR7R1V2FeA”uh1jhjïjKubhŒ.”…”�”}”(hjïh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hýh³hÇh´MWhjÞh²hubj�)�”}”(hŒB.. _Backporting Linux Kernel Patches: https://youtu.be/sBR7R1V2FeA”h]”h}”(h]”Œ backporting-linux-kernel-patches”ah ]”h"]”Œ backporting linux kernel patches”ah$]”h&]”jþjuh1jŒh´M\hjÞh²hh³hÇjšKubeh}”(h]”j¼ah ]”h"]”Œexamples”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´MUubeh}”(h]”Œ#backporting-and-conflict-resolution”ah ]”h"]”Œ#backporting and conflict resolution”ah$]”h&]”uh1hÈhhh²hh³hÇh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)�”}”(hÍNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jPŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”(Œb4”]”jîaŒb4 presentation”]”j_aŒgit-mergetool documentation”]”j aŒ combined diff”]”j aŒgit 2.35”]”j aŒrebase tutorial”]”jËaŒ colordiff”]”j§aŒgit rev-parse documentation”]”jLaŒ backporting linux kernel patches”]”j÷auŒrefids”}”Œnameids”}”(j*j'jÖjÑj jVjjxj—j”j¤j¡jzjšj. j+ jö j¹jÕ jØj› jújï jjPjJjê jijã jà jb j‹jIj­jBj?jýjÛjAjújöjjïjìjsjJj4jijôj‹jlj­j©jçŒ colordiff”jÖjpjmjNj(j¢jJjZjxjÛjšj"j¼jjuŒ nametypes”}”(j*‰jÖ‰j ‰j‰j—ˆj¤ˆjz‰j. ˆjö ‰jÕ ‰j› ‰jï ‰jP‰jê ‰jã ˆjb ‰jI‰jBˆjý‰jA‰jö‰jïˆjs‰j4‰jô‰jl‰j©‰j¦ˆjpˆjN‰j¢‰jZ‰jÛ‰j"‰jˆuh}”(j'hÊjÑj7jVjÙjxj j”jŽj¡j›jšjj+ j% j¹j1 jØjp jújØ jjž jJjù jij jà jÚ j‹jí j­je j?j9jÛjSjúj€jjDjìjæjJjjijj‹j7j­j÷jçj}jjŽjÖjÐjmjgj(jëjJjQjxj¬jšj]j¼jÞjjjPjGjrjij”j‹j³jªjÒjÉjôjëjj jDj;jcjZj…j|j§jžjÕjÌjôjëjj jDj;jcjZj…j|j§jžjájØjj÷j"jjDj;jrjij”j‹j¶j­uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”j^Ks…”R”Œparse_messages”]”hŒsystem_message”“”)�”}”(hhh]”hþ)�”}”(hŒ,Duplicate implicit target name: "colordiff".”h]”hŒ0Duplicate implicit target name: “colordiffâ€�.”…”�”}”(hjÊh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hýhjÇubah}”(h]”h ]”h"]”h$]”h&]”jÖaŒlevel”KŒtype”ŒINFO”Œline”MæŒsource”hÇuh1jÅhjŽh²hh³hÇh´MæubaŒtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.