- Python 3.8+
- GNU
patch(Git for Windows includes it, orscoop install patch) - Git
# Add upstream to your vscode fork (once)
git remote add upstream https://github.com/microsoft/vscode.git
git fetch upstream# Step 1: Apply existing patches + commit as baseline
uv run utils/patches.py setup --target "C:\...\coding\vscode"
# Step 2: Make your changes in the vscode tree (edit files, etc.)
# Step 3: Generate patch (diffs your changes against the baseline, then resets tree)
uv run utils/patches.py generate --target "C:\...\coding\vscode" --name category/my-patch
# Or if something goes wrong, reset manually:
uv run utils/patches.py teardown --target "C:\...\coding\vscode"setup applies all existing patches and commits them as a baseline. generate diffs only your new changes against that baseline, so patches never overlap with each other. The tree is automatically reset after generation.
- Sync:
uv run utils/patches.py sync --vscode-dir "..." - Setup:
uv run utils/patches.py setup --target "..." - Edit files in vscode
- Generate:
uv run utils/patches.py generate --target "..." --name category/name(tree is auto-reset after generation)
- Sync:
uv run utils/patches.py sync --vscode-dir "..." - Apply:
uv run utils/patches.py apply "..." - If patches fail: fix in vscode, regenerate with
setup-> edit ->generate
When syncing with upstream, a patch can fail because file context changed (line moves, nearby edits). Use this quick recovery flow to regenerate only the failing patch.
- Identify the failing patch from
uv run utils/patches.py apply "..." - Temporarily remove (or comment) that patch from
patches/series - Create baseline without the failing patch:
uv run utils/patches.py setup --target "C:\...\coding\vscode" - In the vscode tree, try applying the old patch to salvage non-conflicting hunks:
git apply --reject --whitespace=nowarn "C:\...\coding\better-vscode\patches\category\name.patch" - Fix rejected hunks manually in vscode (for example, after upstream line shifts)
- Regenerate the same patch name (overwrite):
uv run utils/patches.py generate --target "C:\...\coding\vscode" --name category/name --force - Add the patch back to
patches/seriesin its original position - Validate:
uv run utils/patches.py apply "C:\...\coding\vscode" --dry-run
This keeps patch history clean and avoids rebuilding unrelated patches.
uv run utils/patches.py apply "..."- Build vscode as usual
uv run utils/patches.py apply "..." --reversewhen done