Last active
October 14, 2021 21:32
-
-
Save diodonfrost/f81beb8ccb67716dd1192dd93fafd0dd to your computer and use it in GitHub Desktop.
Move file to another repository while preserving git history
This file contains hidden or 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
| # Copied from https://stackoverflow.com/a/11426261/12560823 | |
| # Create git patch from the source repository | |
| cd repository | |
| git log --pretty=email --patch-with-stat --reverse --full-index --binary -- path/to/file_or_folder > patch | |
| # Apply previous git patch to the destination repository | |
| cd ../another_repository | |
| git am --committer-date-is-author-date < ../repository/patch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment