Skip to content

Instantly share code, notes, and snippets.

@diodonfrost
Last active October 14, 2021 21:32
Show Gist options
  • Select an option

  • Save diodonfrost/f81beb8ccb67716dd1192dd93fafd0dd to your computer and use it in GitHub Desktop.

Select an option

Save diodonfrost/f81beb8ccb67716dd1192dd93fafd0dd to your computer and use it in GitHub Desktop.
Move file to another repository while preserving git history
# 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