英文:
Merging master branch to feature branch and then pushing to new repo
问题
我已经在一个功能分支上进行了检出,我在这个分支上进行了许多更改,但尚未推送到主分支。我们的存储库位于GitLab上,但因为我们超过了最大用户限制,所以它已被锁定。因此,我们不能再向这个存储库推送,尽管我们可以拉取。现在团队已经决定迁移到GitHub,迁移存储库到GitHub可能需要一些时间。
我的疑问是,我是否可以在本地将主分支合并到功能分支,然后在从GitLab迁移到GitHub完成后将其提交到GitHub?如果可以,您能否简要介绍一下这个过程,或者至少提供一些讨论这个问题的网页链接?
英文:
I have a feature branch checked out on which I have made many changes that I havent pushed to master yet. Out repo was on gitlab, but it has locked out because we exceeded max user limits. So we cannot push to this repo anymore, though we can pull. Now the team has decided to move to github and it might take some time to move the repo to github.
My doubt is can I merge master branch to feature branch locally and then commit it to github once the migration from gitlab to github completes? If yes, can you please give some overview of the process or at least link of some webpage discussing the same?
答案1
得分: 1
如果您想创建一个仓库的镜像,您可以在clone
和push
命令中都指定--mirror
标志:
git clone --mirror /path/to/old/repo
cd repo
git push --mirror /path/to/new/repo
这将克隆所有引用(分支、标签、注释)到本地的裸仓库,然后将所有本地引用推送到远程仓库。
最后,您可以像克隆其他仓库一样克隆远程仓库。
英文:
If you want to create a mirror of a repository, you can specify the --mirror
flag to both clone
and push
:
git clone --mirror /path/to/old/repo
cd repo
git push --mirror /path/to/new/repo
This will clone all refs (branches, tags, notes) into a local bare repository and then push all local refs to the remote repository.
Finally, you can clone that remote repository like any other repository.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论