Skip to content

Instantly share code, notes, and snippets.

@Amit0617
Created October 15, 2024 08:02
Show Gist options
  • Save Amit0617/5389f0824ea2509907a278e48751a04d to your computer and use it in GitHub Desktop.
Save Amit0617/5389f0824ea2509907a278e48751a04d to your computer and use it in GitHub Desktop.
create and apply patch (personal preferred way)
git format-patch -k --stdout

where -k is number of commits you want to create patch for from the latest situation. --stdout allows to see the merged diff of all these commits, hence preferred to check before creating patches. Now when you are sure, create patch files using

git format-patch -k

if k is 3, it will create 3 patch files for 3 past commits.

Then apply it using

git apply /file/path/000N-commit-message.patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment