Copy a nicely formatted diff straight to your clipboard — ready to paste into a chat, an LLM, a PR description, or a doc. Works from the Source Control view, the Command Palette, or a file's Timeline.
Commands
Copy Diff: Local Changes (staged + unstaged) — everything uncommitted, staged and unstaged combined, plus untracked files, compared to HEAD.
Copy Diff: Unpushed Changes — everything not yet on your remote: diffs from the merge-base with the upstream branch, so it stays correct even if the remote has moved on independently, plus any uncommitted changes. Falls back to a ref picker if the branch has no upstream.
Copy Diff: Entire Branch (vs. base) — everything this branch has done since it diverged from a base branch (e.g. main), regardless of what's already pushed. Configure the base once via copyOrganizedDiff.branchBaseRef, or pick it each time.
Copy Diff: Commit(s)... — multi-select one or more commits from recent history (or type a SHA/ref); a single selection copies that commit's own diff, multiple selections copy the combined range diff spanning them.
Copy Organized Diff of This Commit — right-click a commit in a file's Timeline view.
The four main commands are also grouped behind a single $(copy) button in the Source Control view's title bar — click it for a dropdown with all four, instead of cluttering the title bar with separate icons. Every workspace with multiple Git repositories gets prompted to pick which one.
Output formats
Set copyOrganizedDiff.format to:
markdown (default) — a heading per file plus a fenced ```diff block. Best for pasting into chat tools.
unified — plain git diff output. Turn off the summary to keep it a valid, applyable patch.
xml — <file path="..."> tags per file, for structured LLM context.
Settings
Setting
Default
Description
copyOrganizedDiff.format
markdown
Output format (markdown, unified, xml).
copyOrganizedDiff.contextLines
3
Context lines around each change (git diff -U).
copyOrganizedDiff.includeSummary
true
Prepend a changed-files summary with +/- counts.
copyOrganizedDiff.includeUntracked
true
Include untracked files as additions.
copyOrganizedDiff.excludeGlobs
[]
Glob patterns to exclude (e.g. **/*.lock).
copyOrganizedDiff.unpushedBaseFallback
""
Ref to diff against for Unpushed Changes when there's no upstream.
copyOrganizedDiff.branchBaseRef
""
Ref this branch diverged from, used by Entire Branch (e.g. origin/main).
copyOrganizedDiff.commitLogLimit
50
Number of commits shown in the commit picker.
Requirements
A Git repository open in the workspace, and the built-in VS Code Git extension enabled (it is by default).