Overview
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.
Prerequisite
You must be working in a Git repository that is hosted on GitHub.
Subcommands
The /pr slash command has several subcommands that you can use to perform different actions on your pull requests.
Remarque
All /pr subcommands relate to the current branch—for example, fixing failing CI checks for the pull request associated with the current branch.
| Use this subcommand | To do this | Requires an existing PR | May commit and push |
|---|---|---|---|
/pr or /pr view |
Show the status of the pull request for the current branch. Find out more | Yes | No |
/pr view web |
Open the pull request in your browser. Find out more | Yes | No |
/pr create |
Create or update a pull request. Find out more | No | Yes |
/pr fix feedback |
Address review comments on the pull request. Find out more | Yes | Yes |
/pr fix conflicts |
Sync the branch with the base branch and resolve conflicts. Find out more | Yes | Yes |
/pr fix ci |
Diagnose and fix failing CI checks. Find out more | Yes | Yes |
/pr fix or /pr fix all |
Run all three fix phases in order: feedback, conflicts, then CI. Find out more | Yes | Yes |
/pr auto |
Create a pull request if needed, then loop through all fix phases until all pull request checks are passing. Find out more | No | Yes |
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 Autorisation et refus de l’utilisation de l’outil.
Viewing pull request status
To check the status of the pull request associated with your current branch, enter the following in an interactive session:
/pr
/pr
Opening the pull request in your browser
If you want to view the pull request on GitHub.com instead of in the terminal, enter:
/pr view web
/pr view web
This opens the pull request URL in your default browser.
Creating a pull request
To create a pull request from your current branch, enter:
/pr create
/pr create
Copilot 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, Copilot follows it when generating the pull request title and description.
If a pull request already exists for the current branch, /pr create updates the existing pull request instead of creating a new one.
Adding instructions for pull request creation
You can append instructions after /pr create to guide Copilot. For example:
/pr create prefix the PR title 'Project X: '
/pr create prefix the PR title 'Project X: '
Fixing review feedback
To have Copilot read and address review comments on your pull request, enter:
/pr fix feedback
/pr fix feedback
Copilot 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.
Resolving merge conflicts
To sync your branch with the base branch and resolve any merge conflicts, enter:
/pr fix conflicts
/pr fix conflicts
Copilot fetches the latest base branch, syncs your branch, resolves any conflicts, and pushes the result.
Choosing a merge strategy
When resolving conflicts, Copilot pour CLI needs to know whether to use a rebase or merge strategy. If you have not configured a preference, Copilot prompts you to choose when you run a command that involves conflict resolution.
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 Copilot, or in the repository settings.
- User settings: Add
"mergeStrategy": "rebase"or"mergeStrategy": "merge"to your user-level configuration file (typically~/.copilot/config.json). - Repository settings: Add the same setting to
.github/copilot/settings.jsonin your repository root.
Fixing CI failures
To have Copilot diagnose and fix failing CI checks, enter:
/pr fix ci
/pr fix ci
Copilot 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.
If failures are unrelated to your branch changes, Copilot notes this clearly so you can take appropriate action.
You can append additional context to help Copilot focus on specific failures. For example:
/pr fix ci focus on test failures
/pr fix ci focus on test failures
Fixing all issues at once
To address all outstanding issues on a pull request in a single command, enter:
/pr fix
/pr fix
This runs three phases in order:
- Review feedback — Addresses all review comments.
- Conflicts — Syncs the branch with the base branch and resolves any conflicts.
- CI failures — Diagnoses and fixes failing CI checks.
Automating the full pull request workflow
To have Copilot manage the entire pull request process from creation to a fully green state, enter:
/pr auto
/pr auto
If no pull request exists for the current branch, Copilot 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.
You can append instructions to guide the pull request creation. For example:
/pr auto include migration notes in the description
/pr auto include migration notes in the description