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

Viewed 50

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 clone --bare https://github.forEx.myRepositoryUrl

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

git push --all

git push --tags

1 Answers

You would need at least to fetch the pull/ namespace in which those PR branches are stored.

[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.

Related