GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - RonyMacfly/patchpilot: git apply - style patching, but more forgiving — a Python unified diff applier for AI/chat-generated patches with Markdown fence stripping, context matching, dry-run, and backups.

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
diff.py
diff.py
 
 

Repository files navigation

PatchPilot

A tolerant unified-diff applier in Python — designed for messy AI/chat-generated patches that git apply often rejects.

It applies unified diffs without requiring git or the patch utility, and it can handle common copy/paste problems like Markdown code fences, extra assistant text, and hunks that no longer match exact line numbers.

Built for real-world patch copy/paste chaos.


Why this exists

git apply is excellent when your patch is clean and generated inside a normal Git workflow.

But AI/chat-generated patch output is often messy:

  • wrapped in ```diff fences
  • mixed with prose / explanation text
  • slightly shifted context
  • whitespace differences
  • copied into .diff files with extra noise

This tool is a forgiving fallback:

  • it extracts probable diff content from chat output
  • parses unified diffs (including git-style diff headers)
  • applies hunks using context-based matching, not just strict line numbers
  • falls back to whitespace-tolerant matching
  • creates .bak backups before writing
  • supports dry-run mode

Features

  • ✅ Parses unified diffs (git diff style supported)
  • ✅ Strips Markdown fences and extra assistant text around diffs
  • ✅ Applies hunks using context-based matching
  • ✅ Whitespace-tolerant fallback matching
  • ✅ Creates backup files (*.bak) before modifying files
  • ✅ Dry-run mode to preview changes
  • ✅ Pure Python (no git, no patch binary required)
  • ✅ Prevents writing outside the target repo root

When to use it

Use this when:

  • git apply fails on a patch copied from ChatGPT/Claude/etc.
  • you only have Python installed (no patch utility)
  • you want a safer patch preview with --dry-run
  • you need a quick way to apply small/medium diffs in scripts or tooling

Install

No package install required — it’s a single script.

python3 diff.py --help

About

git apply - style patching, but more forgiving — a Python unified diff applier for AI/chat-generated patches with Markdown fence stripping, context matching, dry-run, and backups.

Topics

automationclicode-generationdeveloper-toolsdiffgit-diffpatchpatcherpythonunified-diffunified-diffs

Resources

Readme
GPL-3.0 license
Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.