# How can I get a patch from a PR?

**URL:** <https://discuss.python.org/t/how-can-i-get-a-patch-from-a-pr/14309>\
**Category:** Python Help\
**Created:** [March 15, 2022, 6:30pm UTC](https://discuss.python.org/t/how-can-i-get-a-patch-from-a-pr/14309 "2022-03-15T18:30:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikecm](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/mikecm/32/5448_2.png) [@mikecm](https://discuss.python.org/u/mikecm)\
**Post date:** [March 15, 2022, 6:30pm UTC](https://discuss.python.org/t/how-can-i-get-a-patch-from-a-pr/14309/1 "2022-03-15T18:30:57Z")

</div>

I looked at [Creating patch from GitHub pull request (Example)](https://coderwall.com/p/6aw72a/creating-patch-from-github-pull-request)  
and when I tried this one [https://patch-diff.githubusercontent.com/raw/python/cpython/pull/1982.patch](https://patch-diff.githubusercontent.com/raw/python/cpython/pull/1982.patch)  
and ran

cpython on  main [$] via 🐍 v3.11.0a6+  
✦ ❯ git am --patch-format=mbox 1982.patch  
Applying: bpo-30587: Adds signature checking for mock autospec object method calls  
error: patch failed: Lib/unittest/mock.py:103  
error: Lib/unittest/mock.py: patch does not apply  
error: patch failed: Lib/unittest/test/testmock/testmock.py:1376  
error: Lib/unittest/test/testmock/testmock.py: patch does not apply  
Patch failed at 0001 bpo-30587: Adds signature checking for mock autospec object method calls

Is there ‘correct’ way to do this?  
Or is it that a 3.8 patch is incompatible with the latest 3.11.0a6?

---

<div class="post-metadata">

**Author:** ![jeanas](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/jeanas/32/8115_2.png) [@jeanas](https://discuss.python.org/u/jeanas)\
**Post date:** [March 15, 2022, 6:59pm UTC](https://discuss.python.org/t/how-can-i-get-a-patch-from-a-pr/14309/2 "2022-03-15T18:59:15Z")

</div>

Correct, Git is telling you that the patch does not apply cleanly as the underlying source changed in the meantime. You might want to try `git am -3 1982.patch` (short for `--3way`), which will leave you with conflict markers in the files rather than just failing this way.

---

<div class="post-metadata">

**Author:** ![mikecm](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/mikecm/32/5448_2.png) [@mikecm](https://discuss.python.org/u/mikecm)\
**Post date:** [March 17, 2022, 11:05am UTC](https://discuss.python.org/t/how-can-i-get-a-patch-from-a-pr/14309/3 "2022-03-17T11:05:40Z")

</div>

Yes that worked. I could see in VS code where the issue was and could simply accept/reject changes. Thanks.
