Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save namgivu/a4cf746a52086fc9827cc5eeb941d62a to your computer and use it in GitHub Desktop.
Save namgivu/a4cf746a52086fc9827cc5eeb941d62a to your computer and use it in GitHub Desktop.
extract a git commit as patch file and then apply the patch
extract commit as patch
https://stackoverflow.com/a/6658352/248616
```
cd $source_repo
git format-patch -1 $sha
```
apply the patch
https://stackoverflow.com/a/2250170/248616
```
cd $target_repo
git apply --check a_file.patch
git am --signoff < a_file.patch
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment