Skip to content

Instantly share code, notes, and snippets.

@lcaballero
Last active August 29, 2015 14:13
Show Gist options
  • Save lcaballero/9832047130a786807204 to your computer and use it in GitHub Desktop.
Save lcaballero/9832047130a786807204 to your computer and use it in GitHub Desktop.
One-liner that commit's a change via a SHA from one local git dir to another.
# This one-liner commits a change from another local dir to the current repo.
# It uses a patch file to export the change and the does a 3 way commit.
# Found here: http://stackoverflow.com/questions/5120038/is-it-possible-to-cherry-pick-a-commit-from-another-git-repository
$ git --git-dir=../some_other_repo/.git \
format-patch -k -1 --stdout <commit SHA> | \
git am -3 -k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment