Search code examples
gitgerrit

How do you apply patch file downloaded from gerrit?


In Gerrit, under the download section for a change, there is a section that allows you to download the Patch-File:

enter image description here

Using git apply results in:

$ git apply 441eb56b.diff.base64
fatal: unrecognized input

What command do I use to apply this patch?


Solution

  • base64 --decode c6a9dcdb.diff.base64 > c6a9dcdb.diff
    git apply c6a9dcdb.diff
    

    (Replace c6a9dcdb with whatever abbreviated commit hash Gerrit gave you.)