Files
Advanced-Git/contents/create-patch-from-uncommitted-changes.md
2025-07-26 07:49:48 +00:00

1.1 KiB

⬅️ Back to Sharing Changes as Patch Files

⬆️ Previous Step: Apply Patch with Commit Metadata

Create Patch from Uncommitted Changes

Category: Patch & Diff

Command

git diff > changes.diff

Examples

  • Create a diff file of uncommitted changes.
git diff > changes.diff 
  • Create a diff file for the last commit.
git diff HEAD~1 > last-commit.diff 

Steps

  1. Run 'git diff > changes.diff' to save uncommitted changes to a file.

Warnings

  • ⚠️ This does NOT preserve commit metadata or history—just raw changes.

➡️ See the Next Step: Apply Diff File


Author: mike-rambil • Updated: 2024-06-10 • Tags: diff, uncommitted, snapshot