简体   繁体   中英

Fork github repository and its pull requests

I'm looking for a way to recover pull requests from a forked repository. Is it possible?

When one fork a repository, GitHub only forks the code, not the pull requests.

However, you can retrieve the pull requests from the upstream repository by leveraging the GitHub Pull Request API .

By default, only the PR which are currently opened are listed. You can access the closed ones by passing an optional state parameter.

Note: This will allow you to retrieve the metatdata of the pull requests of any repository (forked or not).

Alternative (by hand) way

$ mkdir libgit2
$ git clone http://github.com/libgit2/libgit2
$ git fetch origin +refs/pull/*:refs/remotes/pull/*

This will retrieve every pull request ( opened and closed ) from the GitHub hosted repository and create a branch per pull request in you local repository.

Warning: this is an undocumented GitHub feature and might stop working without notice.

据我所知,没有办法通过UI进行此操作,但是API确实在此处提供了请求请求访问因此您可以以编程方式相当简单地完成此操作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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