Push local Git repo to new remote including all branches and tags

590    Asked by JenniferFraser in Python , Asked on Jul 15, 2021

I have a local Git repo that I would like to push to a new remote repo (brand new repo set up on Beanstalk, if that matters). My local repo has a few branches and tags and I would like to keep all of my histories. It looks like I basically just need to do a git push, but that only uploads the master branch. How do I push everything so I get a full replica of my local repo on the remote?


Answered by George Budd

To solve git push all branches to remote, use the following command

Say, the remote is "origin":
$ git push REMOTE '*:*'
$ git push REMOTE --all

In order to push all your tags:

    $ git push REMOTE --tags

Also, these things can also be done with the help of this single command:

    $ git push REMOTE --mirror

Note that: --mirror, will push your remotes as well, so this might not be exactly what you want.



Your Answer

Interviews

Parent Categories