Generate and apply a patch for commits in Git
Use this to generate a patch file for any number of git commits, in this example the last 4:
git format-patch -4 HEAD --stdout > 0001-last-4-commits.patch
To test if the patch applies cleanly:
git apply --check 0001-last-4-commits.patch
To finally apply the patch:
git am --signoff 0001-last-4-commits.patch
Written by Sebastian Wallin
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#