Created
May 30, 2021 08:48
-
-
Save namgivu/a4cf746a52086fc9827cc5eeb941d62a to your computer and use it in GitHub Desktop.
extract a git commit as patch file and then apply the patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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