Skip to main content

GitHub Copilot Chat in GitHub.com verwenden

Sie können GitHub Copilot Chat in GitHub.com verwenden, um allgemeine Fragen zur Softwareentwicklung oder spezifische Fragen zum Code in einem Repository zu beantworten.

Overview

GitHub Copilot Chat in GitHub.com is a chat interface that lets you ask and receive answers to coding-related questions on GitHub.com.

Note: Copilot Chat is also available in selected IDEs. For information on using GitHub Copilot Chat in an IDE, see "Using GitHub Copilot Chat in your IDE."

Copilot Chat can help you with a variety of coding-related tasks, like offering you code suggestions, providing natural language descriptions of a piece of code's functionality and purpose, generating unit tests for your code, and proposing fixes for bugs in your code. For more information, see "About GitHub Copilot Chat in GitHub.com."

On GitHub.com, you can use Copilot Chat to ask:

Limitations

  • Chat responses may be suboptimal if you ask questions about a specific repository that you've selected as a context, and the repository has not been indexed for semantic code search. Anyone who gets access to Copilot from the organization that owns a repository can index that repository. For more information, see "Asking exploratory questions about a repository."
  • The quality of the results from Copilot Chat may, in some situations, be degraded if very large files, or a large number of files, are used as a context for a question.

Prerequisites

Powered by skills

Under the hood, Copilot is powered by a collection of skills that are dynamically selected based on the question you ask. You can tell which skill was selected by Copilot based on the status updates in the chat window.

You can also explicitly ask GitHub Copilot Chat in GitHub.com to use a particular skill - for example, Use the Bing skill to find the latest GPT4 model from OpenAI.

Currently available skills

Note: You can generate this list yourself by asking Copilot: What skills do you have available?

SkillDescriptionEnabled by default?Example question
codesearchNatural language code search in the default branch of the Git repository. This skill is useful when you want to know where or how certain functionality has been implemented in the code. Note: this requires indexing to be enabled for the repository (see the note above indexing below).YesWhere is the logic that controls the user session management, and how does it work?
show-symbol-definitionRetrieves the lines of code that define a specific code symbol (function, class, or struct) in the default branch of the Git repository. This skill is useful when you have the exact name of a symbol, and want to understand it.YesWrite unit tests for the AuthUser method
pathsearchRetrieves a specific file in the default branch of the Git repository. This skill is useful when you provide the exact path of a file in the repository.YesWhat logic does user_auth.js encapsulate?
bing-searchSearches the web using the Bing search engine. This skill is useful for teaching Copilot about recent events, new developments, trends, technologies, or extremely specific, detailed, or niche subjects.No (requires admin approval - see "Enabling GitHub Copilot Enterprise features")What are some recent articles about SAT tokens securing against vulnerabilities in Node?

Asking a general question about software development

You can ask a general question about software development that is not focused on a particular context, such as a repository or a knowledge base.

Depending on the question you ask, and your enterprise and organization settings, Copilot may respond using information based on the results of a Bing search. By using Bing search, Copilot can answer a broad range of tech-related questions with up-to-date details based on information currently available on the internet. For information on how to enable or disable Bing search integration, see "Enforcing policies for GitHub Copilot in your enterprise."

Note: Bing search integration into Copilot Chat in GitHub.com is currently in beta and is subject to change.

  1. On any page on GitHub.com, click the GitHub Copilot icon at the top right of the page.

    The GitHub Copilot Chat panel is displayed. To resize the panel, click and drag the top or left edge.

  2. If the panel contains a previous conversation you had with Copilot, click the "New conversation" icon (a plus sign) at the top right of the panel.

    Screenshot of the new conversation button, highlighted with a dark orange outline.

  3. If the panel is headed "Chatting about OWNER/REPOSITORY," click All repositories.

    Screenshot of the Copilot chat panel page with "All repositories" highlighted with a dark orange outline.

  4. If the "Ask Copilot" page is displayed in the panel, click General purpose chat.

    Screenshot of the Copilot chat panel with "General purpose chat" highlighted with a dark orange outline.

  5. At the bottom of the panel, in the "Ask Copilot" box, type a question and press Enter.

    Some examples of general questions you could ask are:

    • What are the advantages of the Go programming language?
    • What is Agile software development?
    • What is the most popular JavaScript framework?
    • Give me some examples of regular expressions.
    • Write a bash script to output today's date.
  6. If Copilot uses a Bing search to answer your question, "Results from Bing" is displayed above the response. Click this to see the search results that Copilot used to answer your question.

  7. Within a conversation thread, you can ask follow-up questions. Copilot will answer within the context of the conversation. For example, you could type "tell me more" to get Copilot to expand on its last comment.

    You can use your initial question as a foundation for follow-up questions. A detailed foundational prompt can help Copilot provide more relevant answers to your follow-up questions. For more information, see "Prompting GitHub Copilot Chat to become your personal AI assistant for accessibility" on the GitHub Blog.

  8. To jump back into a previous conversation you had with Copilot, click the "View conversations" icon (a clock face surrounded by a circular arrow) at the top right of the panel.

    Screenshot of the "Conversation history" icon, highlighted with a dark orange outline.

Asking exploratory questions about a repository

Copilot allows you to use natural language questions to explore repositories on GitHub. This can help you get a better understanding of where specific aspects of a codebase are implemented.

  1. On any page on GitHub.com, click the GitHub Copilot icon at the top right of the page.

    The GitHub Copilot Chat panel is displayed. To resize the panel, click and drag the top or left edge.

  2. If the panel contains a previous conversation you had with Copilot, click the "New conversation" icon (a plus sign) at the top right of the panel.

    Screenshot of the new conversation button, highlighted with a dark orange outline.

  3. If the "Ask Copilot" page is not displayed in the panel, click All repositories.

    Screenshot of the Copilot chat panel page with "All repositories" highlighted with a dark orange outline.

  4. On the "Ask Copilot" page, select a repository to provide a context for your question.

    For example, you could choose a repository whose code you want to understand better.

    You can search for a repository if you don't see one you want to use.

    Note:

    Copilot's ability to answer natural language questions like these in a repository context is improved when the repository has been indexed for semantic code search. The indexing status of the repository is displayed when you start a conversation that has a repository context.

    If you get access to Copilot from the organization that owns the repository, and the repository has not been indexed, an Index REPOSITORY NAME button is displayed. Click this button to start the indexing process.

    Screenshot showing the 'Index REPOSITORY NAME' button highlighted with a dark orange outline.

  5. In the "Ask Copilot" box, type a question and press Enter.

    For example, you could ask:

    • Where is rate limiting implemented in our API?
    • How does the WidgetFactory class work?
    • Where is the code for converting an organization member to be an outside collaborator?
    • Where are SAT tokens generated?

    Copilot replies in the chat panel.

  6. To jump back into a previous conversation you had with Copilot, click the "View conversations" icon (a clock face surrounded by a circular arrow) at the top right of the panel.

    Screenshot of the "Conversation history" icon, highlighted with a dark orange outline.

Asking a question about a specific file or symbol

You can ask Copilot about a specific file or symbol within a repository.

Note: A "symbol" is a named entity in code. This could be a variable, function, class, module, or any other identifier that's part of a codebase.

  1. On any page on GitHub.com, click the GitHub Copilot icon at the top right of the page.

    The GitHub Copilot Chat panel is displayed. To resize the panel, click and drag the top or left edge.

  2. If the panel contains a previous conversation you had with Copilot, click the "New conversation" icon (a plus sign) at the top right of the panel.

    Screenshot of the new conversation button, highlighted with a dark orange outline.

  3. If the "Ask Copilot" page is not displayed in the panel, click All repositories.

    Screenshot of the Copilot chat panel page with "All repositories" highlighted with a dark orange outline.

  4. On the "Ask Copilot" page, select a repository to provide a context for your question.

    For example, you could choose a repository whose code you want to understand better.

    You can search for a repository if you don't see one you want to use.

  5. Click the "Attach files or symbols" button (a paperclip icon) at the bottom of the chat panel, then search for and select one or more files and symbols.

    Screenshot of the "Attach files or symbols" button, highlighted with a dark orange outline.

  6. In the "Ask Copilot" box, type a question and press Enter.

    Copilot replies in the chat panel.

  7. To jump back into a previous conversation you had with Copilot, click the "View conversations" icon (a clock face surrounded by a circular arrow) at the top right of the panel.

    Screenshot of the "Conversation history" icon, highlighted with a dark orange outline.

Asking a question about a knowledge base

Organization owners can create knowledge bases, grouping together Markdown documentation across one or more repositories. You can use a knowledge base to ask questions with that context in mind.

When you enter a query, Copilot searches for relevant documentation snippets, synthesizes a summary of the relevant snippets to answer your question, and provides links to the source documentation for additional context.

  1. On any page on GitHub.com, click the GitHub Copilot icon at the top right of the page.

    The GitHub Copilot Chat panel is displayed. To resize the panel, click and drag the top or left edge.

  2. If the panel contains a previous conversation you had with Copilot, click the "New conversation" icon (a plus sign) at the top right of the panel.

    Screenshot of the new conversation button, highlighted with a dark orange outline.

  3. If the "Ask Copilot" page is not displayed in the panel, click All repositories.

    Screenshot of the Copilot chat panel page with "All repositories" highlighted with a dark orange outline.

  4. Start a conversation with Copilot by either selecting a repository or clicking General purpose chat.

  5. Click the "Attach knowledge" button (a book icon) at the bottom of the chat panel, to view a list of the knowledge bases that you have access to.

    Screenshot of the "Attach knowledge" icon, highlighted with a dark orange outline.

  6. Click the knowledge base that you want to use as context.

    For example, you could choose a knowledge base containing your organization's internal developer documentation.

    You can search for a knowledge base if you don't see one you want to use.

    Screenshot showing the "Attach knowledge" popover with a list of knowledge bases.

  7. At the bottom of the page, in the "Ask Copilot" box, type a question and press Enter.

    For example, if you chose a knowledge base with your organization's internal developer documentation, you could ask:

    • How do I deploy a new application?
    • What's the process for creating a new REST API?
    • What are our best practices for logging?
  8. The response will typically contain numbered references to files that Copilot uses to generate the answer, from the knowledge base you selected. To list the sources that were used, click NUMBER references.

    Screenshot showing an expanded list of source references.

  9. To display information about a source reference, click its entry in the list.

    Alternatively, to open the complete file, click the ellipsis (...), then select Open.

  10. Within a conversation thread, you can ask follow-up questions. Follow-up questions will continue to use the selected knowledge base as context until you explicitly detach the knowledge base or select a different one.

  11. To jump back into a previous conversation you had with Copilot, click the "View conversations" icon (a clock face surrounded by a circular arrow) at the top right of the panel.

    Screenshot of the "Conversation history" icon, highlighted with a dark orange outline.

Asking questions about specific pieces of code

You can chat with Copilot about a file in your repository, or about specific lines of code within a file.

  1. On GitHub.com, navigate to a repository and open a file.

  2. Do one of the following:

    • To ask a question about the entire file, click the Copilot icon () at the top right of the file view.

      Screenshot of the Copilot button, highlighted with a dark orange outline, at the top of the file view.

    • To ask a question about specific lines within the file:

      1. Select the lines by clicking the line number for the first line you want to select, holding down Shift and clicking the line number for the last line you want to select.
      2. To ask your own question about the selected lines, click the Copilot icon () to the right of your selection. This displays the GitHub Copilot Chat panel with the selected lines indicated as the context of your question.
      3. To ask a predefined question, click the downward-pointing button beside the Copilot icon, then choose one of the options.

      Screenshot of the Copilot buttons, highlighted with a dark orange outline, to the right of some selected code.

  3. If you clicked the Copilot icon, type a question in the "Ask Copilot" box at the bottom of the chat panel and press Enter.

    For example, if you are asking about the entire file, you could enter:

    • Explain this file.
    • How could I improve this code?
    • How can I test this script?

    If you are asking about specific lines, you could enter:

    • Explain the function at the selected lines.
    • How could I improve this class?
    • Add error handling to this code.
    • Write a unit test for this method.

    Copilot responds to your request in the panel.

    Screenshot of a response to the question "What does the function at the selected lines do?"

  4. You can continue the conversation by asking a follow-up question. For example, you could type "tell me more" to get Copilot to expand on its last comment.

  5. To clear, delete, or rename the current conversation thread, or to start a new thread, type / in the "Ask Copilot" box, select from the options that are displayed, then press Enter.

  6. To view a conversation in immersive mode, displaying just the conversation thread, click the dashed box icon at the top right of the conversation thread.

    Screenshot of the immersive mode button at the top right of the Copilot panel. The button is highlighted with a dark orange outline.

Finding out about the changes in a pull request

You can ask Copilot to explain what's changed in any of the files in a pull request.

  1. On GitHub.com, navigate to a pull request in a repository.

  2. Click the Files changed tab.

  3. Do one of the following:

    • To ask a question about a file that's being changed by a pull request, click at the top right of the file, then click Ask Copilot about this diff.

    • To ask a question about specific lines within a file in the pull request:

      1. Select the lines by clicking the line number for the first line you want to select, holding down Shift and clicking the line number for the last line you want to select.
      2. To ask your own question about the selected lines, click the Copilot icon () to the right of your selection. This displays the GitHub Copilot Chat panel with the selected lines indicated as the context of your question.
      3. To ask a predefined question, click the downward-pointing button beside the Copilot icon and click Explain.
  4. If you clicked the Copilot icon, or you chose Ask Copilot about this diff, type a question in the "Ask Copilot" box at the bottom of the chat panel and press Enter. For example, you could enter:

    • Why has this module been included?
    • What is `actorData` in this line?
    • Explain this `do..end` block.
    • What's the purpose of this file?

You can ask Copilot a question about an entire repository by typing your question in the main search box of the repository.

  1. Navigate to a repository on GitHub.com.

  2. Press /, or click in the main search box at the top of the page.

  3. In the search box, after repo:OWNER/REPO, type the question you want to ask Copilot.

    For example, you could enter:

    • What does this repo do?
    • Where is authentication implemented in this codebase?
    • How does license file detection work in this repo?
  4. Click Ask Copilot.

    Screenshot of the main search box on GitHub. The drop-down option "Ask Copilot" is highlighted with an orange outline.

    The GitHub Copilot Chat panel is displayed and Copilot responds to your request.

Sharing feedback about GitHub Copilot Chat in GitHub.com

Note: The ability to provide feedback to GitHub about Copilot pull request summaries is dependent on enterprise settings. For more information, see "Enabling GitHub Copilot Enterprise features."

To give feedback about a particular Copilot Chat response, click either the thumbs up or thumbs down icon at the bottom of each chat response.

To give feedback about Copilot Chat in general, click the ellipsis (...) at the top right of the chat panel, then click Give feedback.