{"category":"text","endpoint":"https://setget.net/v1/tools/patch-apply","examples":[{"input":{"patch":"--- before\n+++ after\n@@ -1,3 +1,4 @@\n apple\n-banana\n+blueberry\n cherry\n+date\n","text":"apple\nbanana\ncherry\n"},"output":{"added":2,"hunks":1,"removed":1,"text":"apple\nblueberry\ncherry\ndate\n"}},{"input":{"patch":"@@ -2 +2 @@\n-two\n+2\n","text":"one\ntwo\n"},"output":{"added":1,"hunks":1,"removed":1,"text":"one\n2\n"},"title":"A patch without file headers"}],"input_schema":{"additionalProperties":false,"properties":{"patch":{"description":"A unified diff for one file.","examples":["--- before\n+++ after\n@@ -1,3 +1,4 @@\n apple\n-banana\n+blueberry\n cherry\n+date\n"],"type":"string"},"text":{"description":"The original text to change.","examples":["apple\nbanana\ncherry\n"],"type":"string"}},"required":["text","patch"],"type":"object"},"keywords":["patch","apply patch","apply diff","unified diff","git apply","merge changes","hunk"],"related":["diff","json-patch-apply","find-replace"],"slug":"patch-apply","summary":"Apply a unified diff to a text and get the patched result, with clear errors when a hunk does not fit.","tier":"inline","title":"Apply a patch","url":"https://setget.net/tools/patch-apply"}
