Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding example for creating PR from fork #1944

Merged
merged 2 commits into from
Feb 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/demos/exploring-pull-requests.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
### Creating new pull request from a fork
**Scenario:**
Creating a pull request from a fork/branch (head) and pulling into octokit.net/master (base)
When you are opening a PR against a repository within an organization, owner is the name of the organization
In this scenario as we are merging to octokit/octokit.net:master, owner=octokit

```csharp
public async Task CreatePullRequestFromFork()
{
GitHubClient ghClient = new GitHubClient(new ProductHeaderValue("MyLib", "v2.0.0"));
ghClient.Credentials = new Credentials("apiToken");

NewPullRequest newPr = new NewPullRequest("PrTitle", "forkName:branchName", "master");
var octokitRepo = await ghClient.Repository.Get("octokit", "ocktokit.net");

var pullRequest = await ghClient.PullRequest.Create("octokit", "octokit.net", newPr);
// Or
var alternatePr = await ghClient.PullRequest.Create(octokitRepo.Id, newPr);
}
```

**Scenario:** I have a lot of small pull requests to review, but things are a mess
- old pull requests which might be superseded by new ones, and it's hard to see from
the descriptions what the changes actually represent.
Expand Down