简体   繁体   English

如何将拉取请求从一个 Git 服务器迁移到另一个 Git 服务器以获取存储库?

[英]How can I migrate the pull requests from one Git Server to another Git Server for a repository?

I am using below commands to migrate the repository from one Git server to another.I am able to move the tags but unable to move the pull requests.我正在使用以下命令将存储库从一个 Git 服务器迁移到另一个。我能够移动标签但无法移动拉取请求。

git clone --bare https://github.forEx.myRepositoryUrl git clone --bare https://github.forEx.myRepositoryUrl

git remote set-url origin git@github.com:Example/myRepositoryUrl.git git remote set-url origin git@github.com:Example/myRepositoryUrl.git

git push --all git push --all

git push --tags git push --标签

You would need at least to fetch the pull/ namespace in which those PR branches are stored.您至少需要获取存储这些 PR 分支的pull/命名空间。

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = https://github.forEx.myRepositoryUrl
    fetch = +refs/pull/*/head:refs/remotes/origin/pr/*

And create local branches for you to push back to the new repository.并为您创建本地分支以推送回新的存储库。

git fetch
git for-each-ref refs/heads/pull/* --format='%(refname:short)'| \
  while read ref; do \
    git switch pull/${ref} \
  done

That might now however transfer the actual pull request item, with its comments and validation.但是,这现在可能会传输实际的拉取请求项目及其评论和验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM