Skip to main content

Demander à Copilot de créer une requête de tirage

Vous pouvez demander à Copilot de créer une demande de tirage (pull request) à partir de la page Agents, Copilot Chat, ou d'outils de codage agentique et d'IDE prenant en charge le protocole Model Context (MCP).

Qui peut utiliser cette fonctionnalité ?

Agent de codage Copilot est disponible avec les forfaits GitHub Copilot Pro, GitHub Copilot Pro+, GitHub Copilot Business et GitHub Copilot Enterprise. L'accès aux essais de Copilot sera bientôt disponible. L'agent est disponible dans tous les référentiels, sauf s'il a été explicitement désactivé et dans les référentiels appartenant à comptes d’utilisateur managés.
Sign up for Copilot

Remarque

Introduction

You can ask Copilot to work on a task from:

  • The Agents panel, available across GitHub
  • The Agents page on GitHub
  • Copilot Chat in Visual Studio Code, Visual Studio, JetBrains IDEs and GitHub.com
  • Your preferred IDE or agentic coding tool with Model Context Protocol (MCP) support
  • The Raycast launcher on macOS

Copilot 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 About GitHub Copilot coding agent.

Asking Copilot to create a pull request from the Agents panel or page

You can ask Copilot to open a pull request from either the Agents panel or the Agents page. The only difference is the entry point - once you see the "New agent task" form, the steps are the same.

  1. Open the Agents panel or page:

    • Open the Agents panel: Click in the navigation bar at the top right of GitHub.
    • Navigate to the Agents page: Go to github.com/copilot/agents. You can also get here by opening the Agents panel, then clicking View all.
  2. Using the dropdown menu in the prompt field, select the repository you want Copilot to work in.

  3. Type a prompt describing your request.

    For example, Implement a user friendly message for common errors.

  4. Optionally, select a base branch for Copilot's pull request. Copilot will create a new branch based on this branch, then push the changes to a pull request targeting that branch.

  5. Click Start task or press Return.

    Copilot will start a new session, which will appear in the list below the prompt box. Copilot 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 Copilot to create a pull request from Copilot Chat in Visual Studio Code

  1. Install the GitHub Pull Requests extension for Visual Studio Code.

  2. Open GitHub Copilot Chat in Visual Studio Code.

  3. Type a prompt explaining what you want Copilot to do, and add #copilotCodingAgent to the prompt.

    For example, Put backticks around file names and variables in output #copilotCodingAgent

    Conseil

    • To help Copilot, you can select the relevant line(s) of code before submitting your prompt.
  4. Submit your prompt.

    Copilot will typically do some research and context-gathering in Visual Studio Code, and then will ask you to confirm that you want to use the coding agent to create a pull request.

  5. Click Continue.

    Copilot 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 Copilot to create a pull request from Copilot Chat in other IDEs

  1. Open GitHub Copilot Chat in Visual Studio or JetBrains IDEs.

  2. Type a prompt, starting with @github, asking Copilot to create a pull request, and giving details of what you want Copilot to change.

    For example, @github Create a PR to put backticks around file names and variables in output.

    Conseil

    • To help Copilot, you can select the relevant line(s) of code before submitting your prompt.
    • From Copilot Chat, you can ask Copilot to open a pull request using a specific branch as the base branch by including it in your prompt.
  3. Submit your prompt.

    Copilot asks you to confirm that you want to use the coding agent to create a pull request.

  4. Click Allow.

    Copilot 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 Copilot to create a pull request from Copilot Chat in GitHub.com

  1. Open GitHub Copilot Chat on GitHub.com.

  2. Type a prompt asking Copilot to create a pull request, and giving details of what you want Copilot to change.

    For example, Create a PR in monalisa/bookstore to put backticks around file names and variables in output.

    Conseil

    • You can ask Copilot to open a pull request using a specific branch as the base branch by including it in your prompt.
  3. Submit your prompt.

    Copilot asks you to confirm that you want to use the coding agent to create a pull request.

  4. Click Allow.

    Copilot 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 Copilot to create a pull request from the GitHub MCP server

As an alternative to using Copilot Chat, you can use the remote GitHub MCP server to trigger Copilot coding agent from any MCP host.

Remarque

  • This capability is only available on the remote GitHub MCP server and host applications where remote MCP servers are supported.
  1. Install the GitHub MCP server in your preferred IDE or agentic coding tool. See Using the GitHub MCP Server.

  2. Ensure the create_pull_request_with_copilot tool is enabled.

  3. Open chat.

  4. Type a prompt asking Copilot 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.

    Conseil

    • You can ask Copilot to open a pull request using a specific branch as the base branch by including it in your prompt.
  5. Submit your prompt.

    Copilot 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.

Asking Copilot to create a pull request from Raycast

Raycast is an extensible launcher for macOS. With the GitHub Copilot extension for Raycast, you can start and track Copilot coding agent tasks wherever you are on your computer.

  1. Install Raycast from the Raycast website.

  2. Install the GitHub Copilot extension for Raycast by clicking the Install Extension button on the extension's page.

  3. Open Raycast, search for "Copilot," find the Create Task command, then press Enter.

  4. Click Sign in with GitHub, then complete the authentication flow. Raycast will re-open.

  5. Type a prompt describing what you want Copilot to do.

    For example, Implement a user friendly message for common errors.

  6. Select the repository you want Copilot to work in.

  7. Optionally, select a base branch for Copilot's pull request. Copilot will create a new branch based on this branch, then push the changes to a pull request targeting that branch.

  8. Press Command+Enter to start the task.

    Copilot will start a new session. Copilot 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.

Remarque

If you are unable to select a specific repository when starting a task, the organization that owns the repository may have enabled OAuth app access restrictions. To learn how to request approval for the "GitHub Copilot for Raycast" OAuth app, see Requesting organization approval for OAuth apps.

Monitoring progress

You can view your current and past Copilot sessions from the Agents page and Visual Studio Code. See Tracking GitHub Copilot's sessions.

Further reading