Skip to content

Instantly share code, notes, and snippets.

@giovannibonetti
Created June 8, 2018 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giovannibonetti/440e1e93994c64650318538dcdb5d7ea to your computer and use it in GitHub Desktop.
Save giovannibonetti/440e1e93994c64650318538dcdb5d7ea to your computer and use it in GitHub Desktop.
Useful for migrating between git hosting services
#!/usr/bin/env bash
# Step 1: clone the repository from the old remote
# Step 2: add the new remote
# Based on https://gist.github.com/grimzy/a1d3aae40412634df29cf86bb74a6f72
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
git push --all new-remote
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment