Skip to content

Apply Fixes Locally

Pat Brisbin edited this page Nov 12, 2024 · 1 revision

When Restyled runs, it captures the style fixing commits it makes by running git format-patch <base>. It can sometimes be useful to apply this patch locally and push the commits yourself. This process even preserves all metadata about the commits: timestamp, message, and Restyled as author.

Aside from re-running restyle locally, there are 3 ways to do this:

1- Copy the Patch

If show-patch is true (the default), the patch itself will be printed in the job logs. The patch can be copied and then passed to git am on stdin:

xclip -selection clipboard -o | git am
pbpaste | git am

Note

It may be necessary to View Raw Logs and copy the patch from there.

2- Copy the Base64-encoded Patch

Patches can get quite large. If show-patch-command is true (the default), a base64-encoded version will also be visible in the job logs. This command can be copied and pasted, completely as-is, into a terminal to apply the patch:

{ base64 -d - | git am; } <<'EOM'
...
...
...
EOM

3- Upload Patch Artifact

Some patches can get so large that even a base64-encoded command like this is unwieldy. If this happens often, you may want to have the Upload Patch Artifact example in place. Then you can download and apply the patch without having to copy-paste things out of job logs.

Clone this wiki locally