Home > Software engineering >  Git: fetch pull requests from GitHub
Git: fetch pull requests from GitHub

Time:11-29

As far as I understand, GitHub/Lab uses Git custom references / internals to store Pull Requests in repository.

How can I fetch all the pull requests in my cloned repository?

CodePudding user response:

You need to check which namespace is used for those requests:

  • GitHub: refs/pull/
  • GitLab: refs/merge-requests/
  • BitBucket: refs/pull-requests/

Then, as illustrated in this gist, you can configure your remote refspecs:

[remote "origin"]
    fetch =  refs/heads/*:refs/remotes/origin/*
    url = [email protected]:joyent/node.git
    fetch =  refs/pull/*/head:refs/remotes/origin/pr/*

Also, for GitHub, you can also use gh pr list and gh pr checkout to list/filter your PRs, and checkout only the ones you need.

  • Related