Skip to content

Commit 41c0525

Browse files
authored
Merge pull request #43912 from github/repo-sync
Repo sync
2 parents c4f00e2 + 312f0a0 commit 41c0525

34 files changed

Lines changed: 1556 additions & 334 deletions

content/copilot/how-tos/configure-custom-instructions/add-repository-instructions.md renamed to content/copilot/how-tos/configure-custom-instructions-in-your-ide/add-repository-instructions-in-your-ide.md

Lines changed: 7 additions & 193 deletions
Large diffs are not rendered by default.

content/copilot/how-tos/configure-custom-instructions/index.md renamed to content/copilot/how-tos/configure-custom-instructions-in-your-ide/index.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ intro: 'Learn how to give {% data variables.product.prodname_copilot %} persiste
55
versions:
66
feature: copilot
77
children:
8-
- /add-personal-instructions
9-
- /add-repository-instructions
10-
- /add-organization-instructions
11-
redirect_from:
12-
- /copilot/how-tos/custom-instructions
8+
- /add-repository-instructions-in-your-ide
139
contentType: how-tos
1410
---

content/copilot/how-tos/copilot-cli/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ children:
2525
- /use-copilot-cli-agents
2626
- /administer-copilot-cli-for-your-enterprise
2727
- /speed-up-task-completion
28+
- /manage-pull-requests
2829
- /roll-back-changes
2930
- /chronicle
3031
- /content/copilot/concepts/agents/copilot-cli/about-copilot-cli
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
---
2+
title: 'Managing pull requests with the /pr command'
3+
shortTitle: Manage pull requests
4+
intro: 'Use the `/pr` slash command to view, create, and fix pull requests directly from {% data variables.copilot.copilot_cli_short %}.'
5+
versions:
6+
feature: copilot
7+
contentType: how-tos
8+
category:
9+
- Author and optimize with Copilot # Copilot discovery page
10+
- Build with Copilot CLI # Copilot CLI bespoke page
11+
docsTeamMetrics:
12+
- copilot-cli
13+
---
14+
15+
## Overview
16+
17+
The `/pr` slash command lets you manage the full pull request lifecycle without leaving your terminal. You can check pull request status, create new pull requests, and fix common issues such as review feedback, merge conflicts, and CI failures.
18+
19+
## Prerequisite
20+
21+
You must be working in a Git repository that is hosted on {% data variables.product.prodname_dotcom %}.
22+
23+
## Subcommands
24+
25+
The `/pr` slash command has several subcommands that you can use to perform different actions on your pull requests.
26+
27+
> [!NOTE]
28+
> All `/pr` subcommands relate to the current branch—for example, fixing failing CI checks for the pull request associated with the current branch.
29+
30+
<!-- Use HTML tags rather than Markdown to avoid bad column width rendering. -->
31+
32+
<table>
33+
<thead>
34+
<tr>
35+
<th style="width: 20%;">Use this subcommand</th>
36+
<th style="width: 50%;">To do this</th>
37+
<th style="width: 15%; text-align: center;">Requires an existing PR</th>
38+
<th style="width: 15%; text-align: center;">May commit and push</th>
39+
</tr>
40+
</thead>
41+
<tbody>
42+
<tr>
43+
<td><code>/pr</code> or <code>/pr view</code></td>
44+
<td>Show the status of the pull request for the current branch. <a href="#viewing-pull-request-status">Find out more</a></td>
45+
<td align="center">Yes</td>
46+
<td align="center">No</td>
47+
</tr>
48+
<tr>
49+
<td><code>/pr view web</code></td>
50+
<td>Open the pull request in your browser. <a href="#opening-the-pull-request-in-your-browser">Find out more</a></td>
51+
<td align="center">Yes</td>
52+
<td align="center">No</td>
53+
</tr>
54+
<tr>
55+
<td><code>/pr create</code></td>
56+
<td>Create or update a pull request. <a href="#creating-a-pull-request">Find out more</a></td>
57+
<td align="center">No</td>
58+
<td align="center">Yes</td>
59+
</tr>
60+
<tr>
61+
<td><code>/pr fix feedback</code></td>
62+
<td>Address review comments on the pull request. <a href="#fixing-review-feedback">Find out more</a></td>
63+
<td align="center">Yes</td>
64+
<td align="center">Yes</td>
65+
</tr>
66+
<tr>
67+
<td><code>/pr fix conflicts</code></td>
68+
<td>Sync the branch with the base branch and resolve conflicts. <a href="#resolving-merge-conflicts">Find out more</a></td>
69+
<td align="center">Yes</td>
70+
<td align="center">Yes</td>
71+
</tr>
72+
<tr>
73+
<td><code>/pr fix ci</code></td>
74+
<td>Diagnose and fix failing CI checks. <a href="#fixing-ci-failures">Find out more</a></td>
75+
<td align="center">Yes</td>
76+
<td align="center">Yes</td>
77+
</tr>
78+
<tr>
79+
<td><code>/pr fix</code> or <code>/pr fix all</code></td>
80+
<td>Run all three fix phases in order: feedback, conflicts, then CI. <a href="#fixing-all-issues-at-once">Find out more</a></td>
81+
<td align="center">Yes</td>
82+
<td align="center">Yes</td>
83+
</tr>
84+
<tr>
85+
<td><code>/pr auto</code></td>
86+
<td>Create a pull request if needed, then loop through all fix phases until all pull request checks are passing. <a href="#automating-the-full-pull-request-workflow">Find out more</a></td>
87+
<td align="center">No</td>
88+
<td align="center">Yes</td>
89+
</tr>
90+
</tbody>
91+
</table>
92+
93+
Subcommands that commit and push changes will prompt you for permission before performing potentially destructive actions, unless you have pre-allowed those tools. For more information, see [AUTOTITLE](/copilot/how-tos/copilot-cli/allowing-tools).
94+
95+
## Viewing pull request status
96+
97+
To check the status of the pull request associated with your current branch, enter the following in an interactive session:
98+
99+
```copilot copy
100+
/pr
101+
```
102+
103+
### Opening the pull request in your browser
104+
105+
If you want to view the pull request on {% data variables.product.prodname_dotcom_the_website %} instead of in the terminal, enter:
106+
107+
```copilot copy
108+
/pr view web
109+
```
110+
111+
This opens the pull request URL in your default browser.
112+
113+
## Creating a pull request
114+
115+
To create a pull request from your current branch, enter:
116+
117+
```copilot copy
118+
/pr create
119+
```
120+
121+
{% data variables.product.prodname_copilot_short %} ensures that all local commits are pushed to the remote branch, then creates the pull request. If a pull request template exists in the repository, {% data variables.product.prodname_copilot_short %} follows it when generating the pull request title and description.
122+
123+
If a pull request already exists for the current branch, `/pr create` updates the existing pull request instead of creating a new one.
124+
125+
### Adding instructions for pull request creation
126+
127+
You can append instructions after `/pr create` to guide {% data variables.product.prodname_copilot_short %}. For example:
128+
129+
```copilot copy
130+
/pr create prefix the PR title 'Project X: '
131+
```
132+
133+
## Fixing review feedback
134+
135+
To have {% data variables.product.prodname_copilot_short %} read and address review comments on your pull request, enter:
136+
137+
```copilot copy
138+
/pr fix feedback
139+
```
140+
141+
{% data variables.product.prodname_copilot_short %} fetches all review comment threads on the pull request, determines what changes are requested, applies the changes to your codebase, and commits and pushes the fixes. Actionable code change requests are prioritized over conversational comments.
142+
143+
## Resolving merge conflicts
144+
145+
To sync your branch with the base branch and resolve any merge conflicts, enter:
146+
147+
```copilot copy
148+
/pr fix conflicts
149+
```
150+
151+
{% data variables.product.prodname_copilot_short %} fetches the latest base branch, syncs your branch, resolves any conflicts, and pushes the result.
152+
153+
### Choosing a merge strategy
154+
155+
When resolving conflicts, {% data variables.copilot.copilot_cli_short %} needs to know whether to use a rebase or merge strategy. If you have not configured a preference, {% data variables.product.prodname_copilot_short %} prompts you to choose when you run a command that involves conflict resolution.
156+
157+
To set a default merge strategy so that you are not prompted each time, add the `mergeStrategy` setting to your configuration file. You can set this in your personal user settings for {% data variables.product.prodname_copilot_short %}, or in the repository settings.
158+
159+
* **User settings**: Add `"mergeStrategy": "rebase"` or `"mergeStrategy": "merge"` to your user-level configuration file (typically `~/.copilot/config.json`).
160+
* **Repository settings**: Add the same setting to `.github/copilot/settings.json` in your repository root.
161+
162+
## Fixing CI failures
163+
164+
To have {% data variables.product.prodname_copilot_short %} diagnose and fix failing CI checks, enter:
165+
166+
```copilot copy
167+
/pr fix ci
168+
```
169+
170+
{% data variables.product.prodname_copilot_short %} identifies the failing CI jobs, analyzes the logs to determine root causes, applies targeted fixes, and pushes them. It then re-checks the CI status and repeats the process until the checks pass or it determines that further progress is not possible.
171+
172+
If failures are unrelated to your branch changes, {% data variables.product.prodname_copilot_short %} notes this clearly so you can take appropriate action.
173+
174+
You can append additional context to help {% data variables.product.prodname_copilot_short %} focus on specific failures. For example:
175+
176+
```copilot copy
177+
/pr fix ci focus on test failures
178+
```
179+
180+
## Fixing all issues at once
181+
182+
To address all outstanding issues on a pull request in a single command, enter:
183+
184+
```copilot copy
185+
/pr fix
186+
```
187+
188+
This runs three phases in order:
189+
190+
1. **Review feedback** — Addresses all review comments.
191+
1. **Conflicts** — Syncs the branch with the base branch and resolves any conflicts.
192+
1. **CI failures** — Diagnoses and fixes failing CI checks.
193+
194+
## Automating the full pull request workflow
195+
196+
To have {% data variables.product.prodname_copilot_short %} manage the entire pull request process from creation to a fully green state, enter:
197+
198+
```copilot copy
199+
/pr auto
200+
```
201+
202+
If no pull request exists for the current branch, {% data variables.product.prodname_copilot_short %} creates one first. It then loops through the fix phases—review feedback, conflicts, and CI—repeating until there are no more review comments, no conflicts, and all CI checks pass.
203+
204+
You can append instructions to guide the pull request creation. For example:
205+
206+
```copilot copy
207+
/pr auto include migration notes in the description
208+
```
209+
210+
## Further reading
211+
212+
* [AUTOTITLE](/copilot/how-tos/copilot-cli/allowing-tools)
213+
* [AUTOTITLE](/copilot/reference/copilot-cli-reference/cli-command-reference)

content/copilot/how-tos/configure-custom-instructions/add-organization-instructions.md renamed to content/copilot/how-tos/copilot-on-github/customize-copilot/add-custom-instructions/add-organization-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ redirect_from:
1010
- /copilot/customizing-copilot/adding-organization-custom-instructions-for-github-copilot
1111
- /copilot/how-tos/custom-instructions/adding-organization-custom-instructions-for-github-copilot
1212
- /copilot/how-tos/custom-instructions/add-organization-instructions
13+
- /copilot/how-tos/configure-custom-instructions/add-organization-instructions
1314
contentType: how-tos
1415
category:
1516
- Configure Copilot

content/copilot/how-tos/configure-custom-instructions/add-personal-instructions.md renamed to content/copilot/how-tos/copilot-on-github/customize-copilot/add-custom-instructions/add-personal-instructions.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,33 @@ redirect_from:
88
- /copilot/customizing-copilot/adding-personal-custom-instructions-for-github-copilot
99
- /copilot/how-tos/custom-instructions/adding-personal-custom-instructions-for-github-copilot
1010
- /copilot/how-tos/custom-instructions/add-personal-instructions
11+
- /copilot/how-tos/configure-custom-instructions/add-personal-instructions
1112
contentType: how-tos
1213
category:
1314
- Configure Copilot
1415
---
1516

1617
{% data reusables.copilot.personal-instructions-note %}
1718

18-
You can customize {% data variables.copilot.copilot_chat %} responses in several ways. For an overview, see [AUTOTITLE](/copilot/concepts/about-customizing-github-copilot-chat-responses?tool=webui).
19+
You can layer multiple types of custom instructions to shape {% data variables.copilot.copilot_chat %} responses. For an overview, see [AUTOTITLE](/copilot/concepts/about-customizing-github-copilot-chat-responses?tool=webui).
1920

2021
## About personal custom instructions for {% data variables.copilot.copilot_chat_short %}
2122

22-
Add custom instructions to receive personalized chat responses. Your instructions apply to all your conversations on the {% data variables.product.github %} website. Custom instructions let you specify preferences such as your preferred language or response style.
23+
Personal custom instructions apply to every conversation you have on the {% data variables.product.github %} website, so {% data variables.product.prodname_copilot_short %} always responds in your preferred language, tone, and style.
2324

2425
Examples of instructions you can add:
2526

2627
* `Always respond in Spanish.`
2728
* `Use a helpful, collegial tone. Keep explanations brief, but provide enough context to understand the code.`
2829
* `Always provide examples in TypeScript.`
2930

30-
> [!NOTE]
31-
> * {% data reusables.copilot.custom-instructions-chat-precedence %}
32-
> * {% data reusables.copilot.custom-instructions-conflict %}
31+
{% data reusables.copilot.custom-instructions-chat-precedence %}
32+
33+
{% data reusables.copilot.custom-instructions-conflict %}
3334

3435
## Adding personal custom instructions
3536

36-
To add personal custom instructions in {% data variables.copilot.copilot_chat_short %} on {% data variables.product.github %}:
37+
To add personal custom instructions on {% data variables.product.github %}:
3738

3839
1. Open [{% data variables.copilot.copilot_chat_short %}](https://github.com/copilot?ref_product=copilot&ref_type=engagement&ref_style=text).
3940
1. In the bottom left corner, click your profile picture. Then click **{% octicon "note" aria-hidden="true" aria-label="note" %} Personal instructions**.
@@ -46,7 +47,7 @@ To add personal custom instructions in {% data variables.copilot.copilot_chat_sh
4647
When you select a template, placeholder text appears. Replace placeholders like `{format}` with your preferences.
4748
1. Click **Save**.
4849

49-
Your instructions are now active. They will remain active until you change or remove them.
50+
Your instructions are now active and remain active until you change or remove them.
5051

5152
{% note %}
5253

0 commit comments

Comments
 (0)