Skip to content

Instantly share code, notes, and snippets.

@feymartynov
Last active August 29, 2015 13:57
Show Gist options
  • Save feymartynov/9926367 to your computer and use it in GitHub Desktop.
Save feymartynov/9926367 to your computer and use it in GitHub Desktop.
Migration of a git repository from bitbucket to github
  1. Add temporary github remote
git remote add github git@github.com:github_account_name/repository_name.git
  1. Push to github
git push github -u
  1. Push unmerged branches
for branch in $(git branch -r --no-merged | sed -E 's/origin\/(.*)/\1/'); do git push github origin/`echo $branch`:refs/heads/`echo $branch`; done
  1. Remove temporary github remote
git remote remove github
  1. Change origin to github (must be executed in every local repository)
git remote remove origin && git remote add origin git@github.com:github_account_name/repository_name.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment