Skip to content

Instantly share code, notes, and snippets.

@red-avtovo
Created October 13, 2017 22:34
Show Gist options
  • Save red-avtovo/b840c731a1d8d12272e5e70a4ac026f3 to your computer and use it in GitHub Desktop.
Save red-avtovo/b840c731a1d8d12272e5e70a4ac026f3 to your computer and use it in GitHub Desktop.
push remote git repository to other remote
#!/bin/bash
#move all branches from repo1 to repo2
repo1=origin
repo2=gogs
branches=$(git branch -r | grep -v $repo2 | grep -v $repo1/HEAD)
echo $branches | while read line ; do
branch=${line:${#repo1}+1}
git checkout $branch
git push $repo2 $branch
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment