Explore Courses Blog Tutorials Interview Questions
+1 vote
in DevOps and Agile by (19.4k points)

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?

1 Answer

+1 vote
by (27.5k points)

In order to push all your branches, 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.

Push local Git repo to new remote including all branches and tags
by (9.6k points)
This answer worked for me. Thanks a lot.

Browse Categories