Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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 history.

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?

like image 880
Cory Imdieke Avatar asked Jul 28 '11 20:07

Cory Imdieke


People also ask

How do I push all branches to a new remote?

To push the all branches to remote git, we can use the git push command followed by the --all flag and origin.

How do I push a local repo to a new remote?

To push the commit from the local repo to your remote repositories, run git push -u remote-name branch-name where remote-name is the nickname the local repo uses for the remote repositories and branch-name is the name of the branch to push to the repository. You only have to use the -u option the first time you push.

Does git push push all branches?

No, git push only pushes commits from current local branch to remote branch that you specified in command.


1 Answers

To push all your branches, use either (replace REMOTE with the name of the remote, for example "origin"):

git push REMOTE '*:*' git push REMOTE --all 

To push all your tags:

git push REMOTE --tags 

Finally, I think you can do this all in one command with:

git push REMOTE --mirror 

However, in addition --mirror, will also push your remotes, so this might not be exactly what you want.

like image 67
cmcginty Avatar answered Oct 09 '22 01:10

cmcginty