How to Push All Branches to Remote Git Repo

Cloning a remote repo:

git clone *<repo_url>*

Check out to desired branches:

#one by one
git checkout *<branch_name>*

#for loop for all branches
for remote in `git branch -r | grep -v master `; do git checkout --track $remote ; done

Push branches and tags to the remote repo:

git push --set-upstream *<git_repo_url>* --all
git push *<git_repo_url>*  --tags

Leave a Reply

Your email address will not be published. Required fields are marked *