将本地Git仓库推送到新的远程站点,包括所有分支和标签 [英] Push local Git repo to new remote including all branches and tags

查看:197
本文介绍了将本地Git仓库推送到新的远程站点,包括所有分支和标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个本地的Git仓库,我想推到一个新的远程仓库(如果这很重要的话,就建立在Beanstalk上的全新仓库)。我的本地回购有几个分支和标签,我想保留所有的历史记录。它看起来像我基本上只需要做一个git推,但只上传主分支。如何推送所有内容,以便在远程获得本地回购的完整副本?

要推送所有分支机构,请使用(将REMOTE替换为远程的名称,例如origin):

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

要推送所有标签

  git push REMOTE --tags 

最后,我认为您可以在一个命令中完成以下操作:

  git push REMOTE --mirror 

但是,除了 - mirror ,也会推动你的遥控器,所以这可能不是你想要的。


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?

解决方案

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.

这篇关于将本地Git仓库推送到新的远程站点,包括所有分支和标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆