Git将仓库镜像到特定分支 [英] Git mirror a repo to specific branch

查看:299
本文介绍了Git将仓库镜像到特定分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的公司尝试将github项目添加到我们自己的git服务器上,然后我们可以在上面添加我们自己的功能.我们只想签出一个特定的分支,并将所有分支和标签保留到该分支,然后将(mirror?)复制到我们的git服务器.

our company try to fork a github project to our own git server,then we can add our own features on it. We just want to checkout a specific branch, and keep all branches and tags up to this branch, then copy(mirror ?) to our git server.

推荐答案

在服务器上创建存储库.在其他地方(不在服务器存储库中),仅使用

Create the repo on your server. Elsewhere (not in the server repo), clone just the branch with

git clone-单分支--branch branch_name github_repo_url

告诉git,其中<​​em>您的回购是:

Tell git where your repo is:

git remote add mine your_repo_url

然后,使用以下命令将分支推送到您的仓库:

Then, push the branch to your repo with:

git push -u我的; git push --tags -u我的

git push -u mine; git push --tags -u mine

"mine"是您的仓库的简写名称,可以是任何字符串,替换默认的"origin".

"mine" is the shorthand name of your repo, it could be any string, replacing the default "origin".

这将收集直到 branch_name 的整个历史记录,但不会包含并非原始的提交.

This will gather the entire history leading up to branch_name, but no commits that are not ancestral to it.

这篇关于Git将仓库镜像到特定分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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