Created
December 21, 2017 22:47
-
-
Save jduhls/b160fa1809d1afa8254d0819b0cb069f to your computer and use it in GitHub Desktop.
Migrate a git repo
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
mkdir TEMP_REPO_FOLDERNAME # create a new folder | |
cd TEMP_REPO_FOLDERNAME | |
git init --bare .git # create a bare repo | |
git remote add origin SOURCE_REMOTE_URL # add a remote | |
git fetch origin refs/heads/*:refs/heads/* # fetch heads | |
git fetch origin refs/tags/*:refs/tags/* # fetch tags | |
git init # reinit work tree | |
git checkout master # checkout a branch | |
git remote rm origin # remove remote repo url | |
git remote add origin NEW_REMOTE_URL # new remote url | |
git push -u origin master # now push master | |
git push --all # now push all other branches | |
git push --tags # oh, and don't forget your tags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment