Skip to content
Agentmart
Submit a tool

git-patch-workflow

Creating, managing, and applying unified diff patches with Git for source code modifications.

Skill by cxcscmu

IndexedMIT★ 91
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/cxcscmu-git-patch-workflow

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Creating, managing, and applying unified diff patches with Git for source code modifications.

Use cases: security, productivity

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/git-patch-workflow

What's inside

Skill name
git-patch-workflow
Description
Creating, managing, and applying unified diff patches with Git for source code modifications.
License
MIT
Instructions
99 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Git Patch Workflow

## Creating Patch Files

### Method 1: From Unstaged Changes
```bash
cd /path/to/repo
git diff path/to/file.java > /path/to/patch/fix.patch
```

### Method 2: From Staged Changes
```bash
git diff --cached > /path/to/patch/fix.patch
```

### Method 3: From Commits
```bash
# Create patch from last N commits
git format-patch -N HEAD

# Create patch from specific commit
git show COMMIT_HASH > /path/to/patch/fix.patch
```

## Patch File Structure

A unified diff patch looks like:
```
--- a/original/path/file.java
+++ b/modified/path/file.java
@@ -10,5 +10,6 @@ class MyClass {
     // context line
-    old code here
+    new code here
     // context line
```

Key components:
- `---` prefix: original file
- `+++` prefix: modified file
- `@@` markers: line numbers and context
- `-` prefix: removed lines
- `+` prefix: added lines
- No prefix: context lines

## Applying Patches

### Basic Application
```bash
cd /path/to/repo
patch -p1 < /path/to/patch/fix.patch
```

### With Error Handling
```bash
# Dry-run to test application
patch -p1 --dry-run < /path/to/patch/fix.patch

# Apply with strict checking
patch -p1 < /path/to/patch/fix.patch

# Apply with less strict checking
patch -p0 < /path/to/patch/fix.patch
```

## Best Practices

1. **Use Git Format**: Create patches via `git diff` or `git format-patch` for consistency
2. **Include Context**: Ensure adequate context lines (3+ lines around changes)
3. **Test Patches**: Always dry-run before applying to ensure compatibility
4. **Modular Patches**: Create separate patches for logically independent changes
5. **Clear Names**: Name patches descriptively (e.g., `fix-javascript-security-bypass.patch`)
6. **Document Changes**: Include explanation of what the patch fixes

## Verifying Application

```bash
# Check if patch was applied
git status
git diff HEAD

# Verify specific file was patched
git show HEAD:path/to/file.java | grep "your fix"
```

## Multiple Patches

For multiple related patches:
```bash
# Create patches in order
git diff HEAD~2 HEAD~1 > patch1.patch
git diff HEAD~1 HEAD > patch2.patch

# Apply in sequence
patch -p1 < patch1.patch
patch -p1 < patch2.patch
```

From cxcscmu/SkillLearnBench, MIT.

More from cxcscmu/SkillLearnBench

Signals

Stars
91
Forks
7
Open issues
6
Last commit (this folder)
Apr 24, 2026 (6 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from cxcscmu

Cite this page

git-patch-workflow skill. Agent Mart. https://agentmart.dev/skills/cxcscmu-git-patch-workflow (last updated 2026-10-24)