9.8 KiB
title, shortTitle, intro, product, versions, topics, type, redirect_from
| title | shortTitle | intro | product | versions | topics | type | redirect_from | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Asking Copilot to create a pull request | Create a PR | You can ask {% data variables.product.prodname_copilot_short %} to create a pull request from the Agents page, {% data variables.copilot.copilot_chat_short %}, or agentic coding tools and IDEs with Model Context Protocol (MCP) support. | {% data reusables.gated-features.copilot-coding-agent %}<br><a href="https://github.com/features/copilot/plans?ref_cta=Copilot+plans+signup&ref_loc=asking+copilot+to+create+a+pull+request&ref_page=docs" target="_blank" class="btn btn-primary mt-3 mr-3 no-underline"><span>Sign up for {% data variables.product.prodname_copilot_short %}</span> {% octicon "link-external" height:16 %}</a> |
|
|
how_to |
|
Note
- {% data reusables.copilot.coding-agent.preview-note-text %}
- For an overview of {% data variables.copilot.copilot_coding_agent %}, see AUTOTITLE.
Introduction
You can ask {% data variables.product.prodname_copilot_short %} to work on a task from:
- The Agents page on {% data variables.product.github %}
- {% data variables.copilot.copilot_chat_short %} in {% data variables.product.prodname_vscode %}, {% data variables.product.prodname_vs %}, JetBrains IDEs and {% data variables.product.prodname_dotcom_the_website %}
- Your preferred IDE or agentic coding tool with Model Context Protocol (MCP) support
{% data variables.product.prodname_copilot_short %} will start working on the task, raise a pull request, then request a review from you when it's finished working. For more information, see AUTOTITLE.
Asking {% data variables.product.prodname_copilot_short %} to create a pull request from the Agents page
-
Navigate to the Agents page at github.com/copilot/agents.
You can also reach this page by clicking the {% octicon "copilot" aria-label="Copilot icon" %} button next to the search bar on any page on {% data variables.product.github %}, then selecting Agents from the sidebar.
-
Using the dropdown menu in the prompt field, select the repository you want {% data variables.product.prodname_copilot_short %} to work in.
-
Type a prompt describing your request.
For example,
Implement a user friendly message for common errors.
-
Optionally, select a base branch for {% data variables.product.prodname_copilot_short %}'s pull request. {% data variables.product.prodname_copilot_short %} will create a new branch based on this branch, then push its changes to a pull request targeting that branch.
-
Click the Send now button or press Return.
{% data variables.product.prodname_copilot_short %} will start a new session, which will appear in the list below the prompt box. {% data variables.product.prodname_copilot_short %} will work on the task and push changes to its pull request, then add you as a reviewer when it has finished, triggering a notification.
Asking {% data variables.product.prodname_copilot_short %} to create a pull request from {% data variables.copilot.copilot_chat_short %} in {% data variables.product.prodname_vscode %}
-
Install the GitHub Pull Requests extension for {% data variables.product.prodname_vscode %}.
-
Open {% data variables.copilot.copilot_chat %} in {% data variables.product.prodname_vscode %}.
-
Type a prompt explaining what you want {% data variables.product.prodname_copilot_short %} to do, and add
#copilotCodingAgentto the prompt.For example,
Put backticks around file names and variables in output #copilotCodingAgentTip
- To help {% data variables.product.prodname_copilot_short %}, you can select the relevant line(s) of code before submitting your prompt.
-
Submit your prompt.
{% data variables.product.prodname_copilot_short %} will typically do some research and context-gathering in {% data variables.product.prodname_vscode %}, and then will ask you to confirm that you want to use the coding agent to create a pull request.
-
Click Continue.
{% data variables.product.prodname_copilot_short %} will push up any local changes, start a new session and respond with a link to the pull request it creates. It will work on the task and push changes to the pull request, and then add you as a reviewer when it has finished, triggering a notification.
Asking {% data variables.product.prodname_copilot_short %} to create a pull request from {% data variables.copilot.copilot_chat_short %} in other IDEs
-
Open {% data variables.copilot.copilot_chat %} in {% data variables.product.prodname_vs %} or JetBrains IDEs.
-
Type a prompt, starting with
@github, asking {% data variables.product.prodname_copilot_short %} to create a pull request, and giving details of what you want {% data variables.product.prodname_copilot_short %} to change.For example,
@github Create a PR to put backticks around file names and variables in output.Tip
- To help {% data variables.product.prodname_copilot_short %}, you can select the relevant line(s) of code before submitting your prompt.
- From {% data variables.copilot.copilot_chat_short %}, you can ask {% data variables.product.prodname_copilot_short %} to open a pull request using a specific branch as the base branch by including it in your prompt.
-
Submit your prompt.
{% data variables.product.prodname_copilot_short %} asks you to confirm that you want to use the coding agent to create a pull request.
-
Click Allow.
{% data variables.product.prodname_copilot_short %} will start a new session and respond with a link to the pull request it creates. It will work on the task and push changes to the pull request, and then add you as a reviewer when it has finished, triggering a notification.
Asking {% data variables.product.prodname_copilot_short %} to create a pull request from {% data variables.copilot.copilot_chat_short %} in {% data variables.product.prodname_dotcom_the_website %}
-
Open {% data variables.copilot.copilot_chat %} on {% data variables.product.prodname_dotcom_the_website %}.
-
Type a prompt asking {% data variables.product.prodname_copilot_short %} to create a pull request, and giving details of what you want {% data variables.product.prodname_copilot_short %} to change.
For example,
Create a PR in monalisa/bookstore to put backticks around file names and variables in output.Tip
- You can ask {% data variables.product.prodname_copilot_short %} to open a pull request using a specific branch as the base branch by including it in your prompt.
-
Submit your prompt.
{% data variables.product.prodname_copilot_short %} asks you to confirm that you want to use the coding agent to create a pull request.
-
Click Allow.
{% data variables.product.prodname_copilot_short %} will start a new session and respond with a link to the pull request it creates. It will work on the task and push changes to the pull request, and then add you as a reviewer when it has finished, triggering a notification.
Asking {% data variables.product.prodname_copilot_short %} to create a pull request from the {% data variables.product.github %} MCP server
As an alternative to using {% data variables.copilot.copilot_chat_short %}, you can use the remote {% data variables.product.github %} MCP server to trigger {% data variables.copilot.copilot_coding_agent %} from any MCP host.
Note
- This capability is only available on the remote {% data variables.product.github %} MCP server and host applications where remote MCP servers are supported.
-
Install the {% data variables.product.github %} MCP server in your preferred IDE or agentic coding tool. See AUTOTITLE.
-
Ensure the
create_pull_request_with_copilottool is enabled. -
Open chat.
-
Type a prompt asking {% data variables.product.prodname_copilot_short %} to create a pull request, with the details of what you want to change.
For example,
Open a PR in my repository to expand unit test coverage.Tip
- You can ask {% data variables.product.prodname_copilot_short %} to open a pull request using a specific branch as the base branch by including it in your prompt.
-
Submit your prompt.
{% data variables.product.prodname_copilot_short %} will start a new session, open a draft pull request and work on the task in the background. As it works, it will push changes to the pull request, and once it has finished, it will add you as a reviewer. In most cases, the MCP host will show you the URL of the created pull request.
Monitoring progress
You can view your current and past {% data variables.product.prodname_copilot_short %} sessions from the Agents page and {% data variables.product.prodname_vscode %}. See AUTOTITLE.
