Skip to content

Instantly share code, notes, and snippets.

@dsci
Last active October 6, 2015 06:47
Show Gist options
  • Select an option

  • Save dsci/2953273 to your computer and use it in GitHub Desktop.

Select an option

Save dsci/2953273 to your computer and use it in GitHub Desktop.
creating and applying patches
# First find the commit sha1(s).
git log
# Then, grab the commit sha1(s).
# For a patch of a single commit.
git format-patch -M -C 3cd894a1bc36867d65119b9a490a3813c0d8066a~1..3cd894a1bc36867d65119b9a490a3813c0d8066a
# Before applying, check what will be happen.
git apply --stat <PATCH_NAME>.patch
# Then, check if there will be any trouble.
git apply --check <PATCH_NAME>.patch
# No trouble? Then - apply the changes.
git am --signoff < <PATCH_NAME>.patch
git format-patch -M -C 75c1264618ab836076256712929f24436c93587c..HEAD --stdout > <patch_name>.patch
git format-patch -M -C c127d7762ba50f5748c2ed650da3df18c59fac30~1..c127d7762ba50f5748c2ed650da3df18c59fac30 -- lib/wordify.cms/extension.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment