mirror of
https://github.com/mike-rambil/Advanced-Git.git
synced 2026-01-06 01:19:30 -06:00
1.1 KiB
1.1 KiB
⬅️ Back to Sharing Changes as Patch Files
Create Patch from Last Commit(s)
Command
git format-patch HEAD~1
Examples
- Create a .patch file for the last commit.
git format-patch HEAD~1
- Create a single patch file for all commits on top of main.
git format-patch origin/main..HEAD --stdout > my-changes.patch
Steps
- Run '
git format-patch HEAD~1' to create a patch for the last commit. - Use '
git format-patch origin/main..HEAD --stdout > my-changes.patch' to create a single patch file for multiple commits.
Warnings
- ⚠️ Patch files created this way include commit messages, authorship, and timestamps.
- ⚠️ Use 'git am' to apply these patches on another system.
Links
Tags
patch, format-patch, committed
Author
mike-rambil
Last Updated
2024-06-10