Last active
February 23, 2023 17:34
-
-
Save joeyates/0d7ea137fedd1a5a3941 to your computer and use it in GitHub Desktop.
Copy a commits from one Git repo to another
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
# Copy all modifications to a file from one repo to another | |
for c in `git --git-dir=../path/to/repo/.git log --reverse --pretty=tformat:"%H" -- path/to/file`; do | |
git --git-dir=../path/to/repo/.git format-patch --keep-subject -1 --stdout $c | git am --3way --keep; | |
done |
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
# Copy a single commit from one repo to another | |
git --git-dir=../path/to/repo/.git format-patch --keep-subject -1 --stdout COMMIT | git am --3way --keep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment