将主分支合并到特性分支,然后推送到新存储库。

huangapple go评论81阅读模式
英文:

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

如果您想创建一个仓库的镜像,您可以在clonepush命令中都指定--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.

huangapple
  • 本文由 发表于 2023年6月18日 21:01:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/76500673.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定