17 KiB
title, shortTitle, intro, versions, topics
| title | shortTitle | intro | versions | topics | |||
|---|---|---|---|---|---|---|---|
| Using GitHub Copilot Chat in GitHub.com | Using Chat in GitHub.com | You can use {% data variables.product.prodname_copilot_chat_short %} to answer general questions about software development, or specific questions about the code in a repository. |
|
|
Overview
{% data variables.product.prodname_copilot_chat %} is a chat interface that lets you ask and receive answers to coding-related questions either on {% data variables.product.prodname_dotcom_the_website %} or within a supported IDE. For information on using {% data variables.product.prodname_copilot_chat %} in an IDE, see "AUTOTITLE."
{% data variables.product.prodname_copilot_chat_short %} 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 "AUTOTITLE."
On {% data variables.product.prodname_dotcom_the_website %}, you can use {% data variables.product.prodname_copilot_chat_short %} to ask:
- General software-related questions, without a particular context. For more information, see "Asking a general question about software development."
- Questions asked in the context of your project, or a documentation set. For more information, see "Asking a question with a specific context."
- Questions about a specific file or specified lines of code within a file. For more information, see "Asking questions about specific pieces of code."
- Questions about a pull request diff. For more information, see "Finding out about the changes in a pull request."
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 {% data variables.product.prodname_copilot_short %} from the organization that owns a repository can index that repository. For more information, see "Asking a question with a specific context."
- The quality of the results from {% data variables.product.prodname_copilot_chat_short %} 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
{% data reusables.copilot.chat-subscription-prerequisite %}
- To use {% data variables.product.prodname_copilot_chat_dotcom %}, you must have been granted access to {% data variables.product.prodname_copilot_chat %} as part of {% data variables.product.prodname_copilot_enterprise %}. For more information, see "AUTOTITLE."
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 documentation set.
{% data reusables.copilot.go-to-copilot-page %}
-
If the "Ask {% data variables.product.prodname_copilot_short %}" page is displayed in the panel, click General purpose chat.
-
At the bottom of the panel, in the "Ask {% data variables.product.prodname_copilot_short %}" 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.
-
Within a conversation thread, you can ask follow-up questions. {% data variables.product.prodname_copilot_short %} will answer within the context of the conversation. For example, you could type "tell me more" to get {% data variables.product.prodname_copilot_short %} 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 {% data variables.product.prodname_copilot_short %} provide more relevant answers to your follow-up questions. For more information, see "Prompting {% data variables.product.prodname_copilot_chat %} to become your personal AI assistant for accessibility" on the {% data variables.product.prodname_dotcom %} Blog.
{% data reusables.copilot.chat-conversation-buttons %}
Asking a question with a specific context
You can choose a specific context for your question. This can be a particular repository, one or more files or symbols from the code, or a predefined knowledge base.
{% note %}
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.
{% endnote %}
Organization owners can create organization-visible knowledge bases from repositories within their organization. Organization members can then choose one of these knowledge bases as the context for a conversation with {% data variables.product.prodname_copilot_short %}. For more information, see "AUTOTITLE." TODOCS: THIS WILL NEED REVISED AFTER KNOWLEDGE BASE DOCS ARE UPDATED.
{% data reusables.copilot.go-to-copilot-page %}
-
If the "Ask {% data variables.product.prodname_copilot_short %}" page is not displayed in the panel, click All topics.
-
On the "Ask {% data variables.product.prodname_copilot_short %}" page, search for and select a repository to provide a context for your question.
-
Optionally, if you want to set particular files or symbols from the selected repository as your context, 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.
-
Optionally, if you want to use a knowledge base as the context for your question, click the "Attach knowledge" button (a book icon) at the bottom of the chat panel, then choose a knowledge base.
Selecting a knowledge base replaces the existing repository context and any attachments.
-
In the "Ask {% data variables.product.prodname_copilot_short %}" box, type a question and press Enter.
For example, if you chose the repository you are working in as the context, you could ask:
- What is the main purpose of this repo? What problem does it solve or what functionality does it provide?
- What web frameworks are used in this project?
- Where is rate limiting implemented in our API?
- How is the code organized? Explain the project architecture.
- Are there any specific environment requirements for working on this project?
{% note %}
Note:
{% data variables.product.prodname_copilot_short %}'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 {% data variables.product.prodname_copilot_short %} 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.
{% endnote %}
If you chose a knowledge base as the context - for example, a knowledge base relating to Azure - you could ask:
- What advantages does Azure have over other types of cloud storage?
- How do I block Azure from accessing locations on my network?
- How can I reduce the cost of a hosted website?
- How do I enable MFA?
-
The response typically contains numbered references to files that {% data variables.product.prodname_copilot_short %} used to generate the answer, from the repository or knowledge base you selected. To list the sources that were used, click NUMBER references.
-
To display a source reference in a popup, click its entry in the list.
Alternatively, to navigate to the file, click the ellipsis (...), then select Open.
{% data reusables.copilot.chat-conversation-buttons %}
Asking questions about specific pieces of code
You can chat with {% data variables.product.prodname_copilot_short %} about a file in your repository, or about specific lines of code within a file.
-
On {% data variables.product.prodname_dotcom_the_website %}, navigate to a repository and open a file.
-
Do one of the following:
-
To ask a question about the entire file, click the {% data variables.product.prodname_copilot_short %} icon ({% octicon "copilot" aria-hidden="true" %}) at the top right of the file view.
-
To ask a question about specific lines within the file:
- 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.
- To ask your own question about the selected lines, click the {% data variables.product.prodname_copilot_short %} icon ({% octicon "copilot" aria-hidden="true" %}) to the right of your selection. This displays the {% data variables.product.prodname_copilot_chat %} panel with the selected lines indicated as the context of your question.
- To ask a predefined question, click the downward-pointing button beside the {% data variables.product.prodname_copilot_short %} icon, then choose one of the options.
-
-
If you clicked the {% data variables.product.prodname_copilot_short %} icon, type a question in the "Ask {% data variables.product.prodname_copilot_short %}" 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.
{% data variables.product.prodname_copilot_short %} responds to your request in the panel.
-
You can continue the conversation by asking a follow-up question. For example, you could type "tell me more" to get {% data variables.product.prodname_copilot_short %} to expand on its last comment.
-
To clear, delete, or rename the current conversation thread, or to start a new thread, type
/in the "Ask {% data variables.product.prodname_copilot_short %}" box, select from the options that are displayed, then press Enter. -
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.
Finding out about the changes in a pull request
You can ask {% data variables.product.prodname_copilot_short %} to explain what's changed in any of the files in a pull request.
-
On {% data variables.product.prodname_dotcom_the_website %}, navigate to a pull request in a repository.
-
Click the Files changed tab.
-
Do one of the following:
-
To ask a question about a file that's being changed by a pull request, click {% octicon "kebab-horizontal" aria-label="Show options" %} at the top right of the file, then click Ask {% data variables.product.prodname_copilot_short %} about this diff.
-
To ask a question about specific lines within a file in the pull request:
- 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.
- To ask your own question about the selected lines, click the {% data variables.product.prodname_copilot_short %} icon ({% octicon "copilot" aria-hidden="true" %}) to the right of your selection. This displays the {% data variables.product.prodname_copilot_chat %} panel with the selected lines indicated as the context of your question.
- To ask a predefined question, click the downward-pointing button beside the {% data variables.product.prodname_copilot_short %} icon and click Explain.
-
-
If you clicked the {% data variables.product.prodname_copilot_short %} icon, or you chose Ask {% data variables.product.prodname_copilot_short %} about this diff, type a question in the "Ask {% data variables.product.prodname_copilot_short %}" 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?
Accessing {% data variables.product.prodname_copilot_chat_short %} from the search bar
You can ask {% data variables.product.prodname_copilot_short %} a question about an entire repository by typing your question in the main search box of the repository.
-
Navigate to a repository on {% data variables.product.prodname_dotcom_the_website %}.
-
Press /, or click in the main search box at the top of the page.
-
In the search box, after
repo:OWNER/REPO, type the question you want to ask {% data variables.product.prodname_copilot_short %}.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?
-
Click Ask {% data variables.product.prodname_copilot_short %}.
The {% data variables.product.prodname_copilot_chat %} panel is displayed and {% data variables.product.prodname_copilot_short %} responds to your request.
Sharing feedback about {% data variables.product.prodname_copilot_chat_dotcom %}
To give feedback about a particular {% data variables.product.prodname_copilot_chat_short %} response:
-
Click either the thumbs up or thumbs down icon at the bottom of each chat response.
-
Optionally, provide information about why you liked or disliked the response.
-
Click Submit feedback.
To give feedback about {% data variables.product.prodname_copilot_chat_short %} in general, click the "Give feedback" link at the top right of any {% data variables.product.prodname_copilot_short %} page on {% data variables.product.prodname_dotcom_the_website %}.









