Overview
GitHub Copilot Chat in GitHub is a chat interface that lets you ask and receive answers to coding-related questions on the GitHub website.
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 GitHub Copilot Chat in GitHub の責任ある使用.
On GitHub, you can use Copilot Chat to ask different questions in different contexts. For example, you can ask about a specific repository, a specific issue, or a specific pull request. You can also ask general questions about software development, or about a specific programming language.
Limitations
- 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.
Viewing generated files within Copilot Chat
Note
This feature is currently in パブリック プレビュー and subject to change.
When you ask a question, Copilot may generate one or more files as part of its response. In the Copilot Chat panel, the files are displayed inline, within the chat response. In immersive view (that is, at https://github.com/copilot), the generated files are displayed in a side panel. You can view the files in the panel, or download them to your computer.
For example, asking Generate a simple calculator using HTML, CSS, and JavaScript
may generate multiple files, such as index.html
, styles.css
, and script.js
.
Powered by skills
When using the GPT 4o and Claude 3.5 Sonnet models, Copilot has access to a collection of skills to fetch data from GitHub, which are dynamically selected based on the question you ask. You can tell which skill Copilot used by clicking to expand the status information in the chat window.
You can explicitly ask GitHub Copilot Chat in GitHub to use a particular skill - for example, Use the Bing skill to find the latest GPT4 model from OpenAI
.
You can generate a list of currently available skills by asking Copilot: What skills are available?
Customizing Copilot Chat responses
GitHub Copilot can provide chat responses that are tailored to the way your team works, the tools you use, the specifics of your project, or your personal preferences, if you provide it with enough context to do so. Instead of repeating instructions in each prompt, you can create and save instructions for Copilot Chat to customize what responses you receive.
There are two types of custom instructions you can add for Copilot Chat:
- Repository instructions: You can create a custom instructions file for a repository, so that all prompts asked in the context of the repository automatically include the instructions you've defined
- Personal instructions: You can add personal instructions so that all the chat responses you, as a user, receive are tailored to your preferences
For more information, see Adding repository custom instructions for GitHub Copilot and Adding personal custom instructions for GitHub Copilot.
AI models for Copilot Chat
Copilot でチャット プロンプトに対する回答の生成に使われる大規模言語モデルを変更できます。 質問の種類によっては、別のモデルの方がより良いパフォーマンスを発揮したり、より有用な回答が提供されたり場合があります。 詳しくは、「Copilot Chat の AI モデルを変更する」をご覧ください。
Submitting a question to Copilot Chat
You can open Copilot Chat from any page on GitHub. Certain questions may require you to be in a specific context, such as a repository, issue, or pull request. The following procedure describes how to ask a general software related question, and demonstrates the core functionality of Copilot Chat on GitHub. For more information on other scenarios, see Asking Copilot Chat questions in different contexts.
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 個人のサブスクライバーとしての Copilot ポリシーの管理 and 企業内の Copilot のポリシーと機能を管理する.
Note
Bing search integration is currently in パブリック プレビュー and is subject to change.
-
On any page on GitHub, click the GitHub Copilot icon at the bottom right of the page.
The GitHub Copilot Chat panel is displayed. To resize the panel, click and drag the top or left edge.
-
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.
-
If the panel is headed "Chatting about OWNER/REPOSITORY," click All repositories.
-
If the "Ask Copilot" page is displayed in the panel, click General purpose chat.
-
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.
-
必要に応じて、テキスト ボックスの をクリックして、Copilot が応答を続行しないようにします。
-
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.
-
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.
-
Copilot で前に行った会話に戻るには、 ドロップダウン メニューを選んでから、 [View all conversations] をクリックします。
Asking Copilot Chat questions in different contexts
You can ask Copilot Chat different types of questions depending on where you are on GitHub. For example, to ask a question about a specific repository, you must be in the context of that repository. The following sections describe how to access the different contexts.
For examples of the types of questions you can ask in different contexts, see Getting started with prompts for Copilot Chat.
Asking Copilot Chat questions in a repository
To ask a question about a specific repository, you must be viewing the repository on GitHub.
-
Navigate to a repository on GitHub.
-
In the top right of the page, click the GitHub Copilot icon next to the search bar.
-
The heading at the top of the panel should read "Chatting about" followed by the name of the current repository.
If the wrong repository name is displayed, because you were previously chatting about another repository, click All repositories then choose the repository you want to chat about.
-
At the bottom of the panel, in the "Ask Copilot" box, type a question and press Enter.
Note
Copilot's ability to answer natural language questions 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. For more information, see Indexing repositories for Copilot Chat.
Asking Copilot Chat questions about a specific file or symbol
You can ask Copilot about a specific file, folder, 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.
-
In the top right of the page, click the GitHub Copilot icon next to the search bar.
-
To select a repository for context, click at the bottom of the chat panel, then select "Repositories".
-
Once the repository has been attached, click again, then select "Files, folders, and symbols".
-
Search for and select one or more files, folders, or symbols.
-
In the "Ask Copilot" box, type a question and press Enter.
Copilot replies in the chat panel.
Tip
リポジトリのセマンティック コード検索インデックスが最新の場合、リポジトリ コンテキストでこのような自然言語の質問に答える Copilot の機能は最適化されます。 詳しくは、「Indexing repositories for Copilot Chat」をご覧ください。
Asking Copilot Chat 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.
-
On GitHub, navigate to a repository and open a file.
-
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.
-
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 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.
- To ask a predefined question, click the downward-pointing button beside the Copilot icon, then choose one of the options.
-
-
If you clicked the Copilot icon, type a question in the "Ask Copilot" box at the bottom of the chat panel and press Enter.
Copilot responds to your request in the panel.
Asking questions about GitHub Advanced Security alerts
Copilot allows you to use natural language questions to ask about security alerts in repositories in your organization when these alerts are generated by GitHub Advanced Security features (code scanning, secret scanning, and Dependabot alerts).
-
In the top right of the page, click the GitHub Copilot icon next to the search bar.
-
If the "Ask Copilot" page is not displayed in the panel, click All repositories.
-
On the "Ask Copilot" page, select a repository to provide a context for your question.
For example, you could choose a repository with security alerts you want to understand better.
You can search for a repository if you don't see one you want to use.
-
In the "Ask Copilot" box, type a question and press Enter.
Copilot replies in the chat panel.
Tip
リポジトリのセマンティック コード検索インデックスが最新の場合、リポジトリ コンテキストでこのような自然言語の質問に答える Copilot の機能は最適化されます。 詳しくは、「Indexing repositories for Copilot Chat」をご覧ください。
Asking questions about a specific pull request
You can ask Copilot different questions about a pull request, from different views within the pull request. For example, you can ask Copilot to summarize a pull request, or explain what has changed within specific files or lines of code in a pull request.
Get a summary of a pull request
-
On GitHub, navigate to a pull request in a repository.
-
In the top right of the page, click the GitHub Copilot icon next to the search bar.
-
If the panel contains a previous conversation you had with Copilot, click the plus sign icon at the top right of the Copilot panel to start a new conversation.
-
At the bottom of the Copilot Chat panel, in the "Ask Copilot" box, type a question and press Enter.
Ask about changes to a specific file in a pull request
- On GitHub, navigate to a pull request in a repository.
- Click the Files changed tab.
- Click at the top right of the file, then click Ask Copilot about this diff.
- Type a question in the "Ask Copilot" box at the bottom of the chat panel and press Enter.
Ask about specific lines within a file in a pull request
- On GitHub, navigate to a pull request in a repository.
- Click the Files changed tab.
- Click the line number for the first line you want to select, then hold down Shift and click the line number for the last line you want to select.
- Ask Copilot a question, or choose from a list of predefined questions.
- To ask your own question about the selected lines, to the right of your selection, click the Copilot icon. This displays the GitHub Copilot Chat panel with the selected lines indicated as the context of your question.
Ask why a workflow has failed
-
On GitHub, navigate to a pull request in a repository.
-
Scroll to the bottom of the page, then, next to one of the failing checks, click Details.
-
In the top right of the page, click the GitHub Copilot icon next to the search bar.
-
If the panel contains a previous conversation you had with Copilot, click the plus sign icon at the top right of the Copilot panel to start a new conversation.
-
At the bottom of the Copilot Chat panel, in the "Ask Copilot" box, ask Copilot why the pull request has failed and press Enter.
Copilot will respond with information about why the pull request failed. Copilot may also provide suggestions for how to fix the issue.
- If Copilot has provided steps to fix the issue, you can follow the steps to resolve the problem.
Asking a question about a specific issue or discussion
You can ask Copilot to summarize or answer questions about a specific issue or discussion.
Note
The quality of Copilot Chat's responses may be degraded when working with issues or discussions that have very long bodies or a large number of comments. For example, this may occur if you ask Copilot to summarize a long-running discussion. Where this happens, Copilot will warn you so you can double check its output.
-
Navigate to an issue or discussion on GitHub.
-
In the top right of the page, click the GitHub Copilot icon next to the search bar.
-
If the panel contains a previous conversation you had with Copilot, click the plus sign icon at the top right of the Copilot panel to start a new conversation.
-
At the bottom of the Copilot chat panel, in the "Ask Copilot" box, type a question and press Enter.
Copilot responds to your request in the panel.
Tip
Instead of navigating to an issue or discussion in your browser to ask a question, you can include the relevant URL in your message. For example,
Summarize https://github.com/monalisa/octokit/issues/1
.
Asking a question about a specific commit
You can ask Copilot to explain the changes in a commit.
-
Navigate to a commit on GitHub.
-
In the top right of the page, click the GitHub Copilot icon next to the search bar.
-
If the panel contains a previous conversation you had with Copilot, click the plus sign icon at the top right of the Copilot panel to start a new conversation.
-
At the bottom of the Copilot chat panel, in the "Ask Copilot" box, type a question and press Enter.
Tip
If you know the SHA for a commit, instead of navigating to the commit, you can ask Copilot about the commit from any page in the repository on GitHub by including the SHA in your message. For example,
What changed in commit a778e0eab?
-
必要に応じて、テキスト ボックスの をクリックして、Copilot が応答を続行しないようにします。
Accessing Copilot Chat from the search bar
You can ask Copilot a question about an entire repository by typing your question in the main search box of the repository.
-
Navigate to a repository on GitHub.
-
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 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?
-
Click Ask Copilot.
The GitHub Copilot Chat panel is displayed and Copilot responds to your request.
-
必要に応じて、テキスト ボックスの をクリックして、Copilot が応答を続行しないようにします。
Extending Copilot Chat in GitHub
Note
GitHub Copilot Extensions は パブリック プレビュー 段階であり、変更される可能性があります。
GitHub Copilot Extensions は、外部ツールの機能を Copilot Chat に統合することで、コンテキストの切り替えを減らし、ドメイン固有のコンテキストで応答を受信するのに役立ちます。 GitHub Marketplace から Copilot Extensions をインストールするか、組織内にあるプライベートの Copilot Extensions をビルドし、チャット ウィンドウに「@
」と入力すると、使用可能な拡張機能の一覧を表示できます。 拡張機能を使用するには、一覧から拡張機能を選択するか、完全な置換フィールド名を入力し、プロンプトを入力します。
詳しくは、「拡張情報を使用して外部ツールを Copilot Chat と統合する」をご覧ください。
Sharing Copilot Chat conversations
Note
This feature is currently in パブリック プレビュー and subject to change. During the パブリック プレビュー, this feature is only available to users without enterprise or team memberships.
You can share Copilot Chat conversations from the immersive view (https://github.com/copilot). Shared conversations are public or private (i.e. permission-based), for example, a conversation about a private repository. If you share a private conversation, the recipient must have the necessary permissions to view the content. Shared conversations are read-only—the recipient can view the conversation but cannot interact.
-
In the top right of any page on GitHub, click the GitHub Copilot icon next to the search bar.
-
To view a conversation in immersive mode, click Take conversation to immersive.
-
Once you submit your first prompt, a share button will appear in the upper right corner. Click to open the share dialog.
-
To copy the conversation link, click Create link. The link is copied to your clipboard.
Sharing feedback about GitHub Copilot Chat in GitHub
Note
Copilot pull request summaries に関するフィードバックを GitHub に提供する機能は、エンタープライズ設定によって異なります。 詳しくは、「企業内の Copilot のポリシーと機能を管理する」をご覧ください。
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.