Change the Remote Origin
git remote add new-origin [email protected]:username/your-new-repo.git
Verify the Remote location (optional)
git remote -v
Push all branches to the remote repo
git push new-origin --all
git push new-origin --tags
Fetch the origin
git fetch origin
Create local tracting branches for remote repo
for branch in $(git branch -r | grep 'origin/' | grep -v 'origin/HEAD' | sed 's/origin\///'); do
git checkout -b "$branch" "origin/$branch"
done
Push all branches individually
for branch in $(git branch | sed 's/\* //'); do
git push new-origin "$branch"
done