Skip to content

docs(ai): git apply on diff#377

Merged
KSXGitHub merged 7 commits into
masterfrom
claude/fix-git-diff-apply-IQnp0
Mar 27, 2026
Merged

docs(ai): git apply on diff#377
KSXGitHub merged 7 commits into
masterfrom
claude/fix-git-diff-apply-IQnp0

Conversation

@KSXGitHub

Copy link
Copy Markdown
Owner

This change adds a new instruction to the AI guidance documents to improve efficiency when handling diffs provided by users.

Summary
Added a new best practice guideline across all AI instruction files (Copilot, Agents, Claude, and the shared template) to use git apply when applying user-provided diffs rather than manually interpreting each hunk.

Key Changes

  • Added instruction to use git apply for efficiently applying diffs provided by users
  • Clarified that diffs provided for context or discussion should be handled differently than diffs intended as changes to apply
  • Updated four instruction files to maintain consistency:
    • .github/copilot-instructions.md
    • AGENTS.md
    • CLAUDE.md
    • template/ai-instructions/shared.md

Details
The new guideline emphasizes that manually interpreting each hunk in a diff is slow and error-prone, and recommends using git apply as the standard approach. This improves the workflow for AI assistants when users provide diffs as part of their requests.

https://claude.ai/code/session_013WwSdSkpqSyDZ7WhJWn2f1

claude and others added 5 commits March 27, 2026 17:09
Instead of manually interpreting and applying each hunk via the Edit
tool, agents should pipe diffs through git apply or save to a temp file
and apply. This avoids slow, error-prone block-by-block editing.

https://claude.ai/code/session_013WwSdSkpqSyDZ7WhJWn2f1
When a user provides a diff/patch and asks for it to be applied, agents
should use git apply (or patch -p1 as fallback) instead of manually
interpreting and applying each hunk via the editor. Added nuance that
diffs provided for context/discussion should not be blindly applied.

https://claude.ai/code/session_013WwSdSkpqSyDZ7WhJWn2f1
Remove unnecessary bold emphasis and add conditional ("and you need to
update the files") so the instruction doesn't read as "always apply".

https://claude.ai/code/session_013WwSdSkpqSyDZ7WhJWn2f1

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a consistent guideline across the repository’s AI instruction documents to prefer git apply for user-provided diffs (and to treat context-only diffs differently), improving speed and reducing manual patching errors.

Changes:

  • Add a new best-practice bullet recommending git apply when a user provides an actionable diff.
  • Clarify that diffs provided only for context/discussion should not be applied.
  • Propagate the same instruction across Copilot, Agents, Claude, and the shared template docs.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
template/ai-instructions/shared.md Adds the new git apply guideline to the shared AI instructions template.
CLAUDE.md Mirrors the new git apply guideline in Claude-specific AI instructions.
AGENTS.md Mirrors the new git apply guideline in agent instructions.
.github/copilot-instructions.md Mirrors the new git apply guideline in Copilot instructions.

Comment thread template/ai-instructions/shared.md Outdated
Comment thread CLAUDE.md Outdated
Comment thread AGENTS.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Mar 27, 2026

Copy link
Copy Markdown

Performance Regression Reports

commit: cacc271

There are no regressions.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@KSXGitHub KSXGitHub marked this pull request as ready for review March 27, 2026 18:54
@KSXGitHub KSXGitHub merged commit ff7ee36 into master Mar 27, 2026
17 checks passed
@KSXGitHub KSXGitHub deleted the claude/fix-git-diff-apply-IQnp0 branch March 27, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants