Skip to content

Instantly share code, notes, and snippets.

@tcartwright
Last active January 3, 2024 19:35
Show Gist options
  • Save tcartwright/3c4757c2fe9e4ea8cee2575d8d74d9ad to your computer and use it in GitHub Desktop.
Save tcartwright/3c4757c2fe9e4ea8cee2575d8d74d9ad to your computer and use it in GitHub Desktop.
GIT: Moves a project from one repo to another preserving history
@REM Make sure you are in the root folder of the git repo that you wish to move the code to
git checkout master
git remote add r1remote **url-of-repo1**
git fetch r1remote
git merge r1remote/master --allow-unrelated-histories
git remote rm r1remote
@tcartwright
Copy link
Author

NOTE: When the merge occurs, you should deal with any merge conflicts and commit the changes if you are doing multiple projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment