title | intro | allowTitleToDifferFromFilename | versions | shortTitle | topics | |||
---|---|---|---|---|---|---|---|---|
Quickstart for GitHub Copilot |
Quickly learn how to use {% data variables.product.prodname_copilot %}. |
true |
|
Quickstart |
|
{% webui %}
You can use {% data variables.product.prodname_copilot_short %} to get answers to coding-related questions, such as how best to code something, how to fix a bug, or how someone else's code works. For full details of what {% data variables.product.prodname_copilot_short %} can do, see "AUTOTITLE."
If you have access to {% data variables.product.prodname_copilot_workspace %}, {% data variables.product.prodname_copilot_short %} can also help you when you are editing files in a pull request on the {% data variables.product.github %} website by offering you code completion suggestions. For more information about {% data variables.product.prodname_copilot_workspace %}, see "AUTOTITLE."
Instructions for using {% data variables.product.prodname_copilot_short %} differ depending on where you are using it. This version of the quickstart is for {% data variables.product.github %}. Click the tabs above for instructions on using {% data variables.product.prodname_copilot_short %} in other environments.
{% ifversion fpt %} {% data reusables.copilot.quickstart-signup %} {% endif %}
{% ifversion ghec %}
To use {% data variables.product.prodname_copilot %} on the {% data variables.product.github %} website, you must have an active {% data variables.product.prodname_copilot %} subscription. {% data reusables.copilot.subscription-prerequisite %} {% endif %}
-
On {% data variables.product.github %}, navigate to a repository and open a file.
-
Click the {% data variables.product.prodname_copilot_short %} icon ({% octicon "copilot" aria-hidden="true" %}) at the top right of the file view.
-
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:
- Explain this file.
- How could I improve this code?
- How can I test this code?
{% 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.
There are many more things you can do with {% data variables.product.prodname_copilot_chat_dotcom %}. For example:
- Ask a general question about software development
- Ask exploratory questions about a repository
- Ask a question about a knowledge base
- Find out about the changes in a pull request
- Ask a question about a specific issue or commit
For more information, see "AUTOTITLE."
- Find out more about {% data variables.product.prodname_copilot_chat %} - See "AUTOTITLE{% ifversion fpt %}.{% endif %}"{% ifversion ghec %} and "AUTOTITLE."{% endif %}
- Get {% data variables.product.prodname_copilot_short %} code completion suggestions in an IDE - See "AUTOTITLE."
- Learn how to write effective prompts - See "AUTOTITLE."
- Use {% data variables.product.prodname_copilot_short %} on your mobile device - See "AUTOTITLE."
- Use {% data variables.product.prodname_copilot_short %} on the command line - See "AUTOTITLE."
{% endwebui %}
{% windowsterminal %}
{% data reusables.copilot.quickstart-intro %}
Instructions for using {% data variables.product.prodname_copilot_short %} differ depending on where you are using it. This version of the quickstart is for {% data variables.product.prodname_windows_terminal %}. Click the tabs above for instructions on using {% data variables.product.prodname_copilot_short %} in other environments.
{% ifversion fpt %} {% data reusables.copilot.quickstart-signup %} {% endif %}
{% ifversion ghec %}
- Subscription to {% data variables.product.prodname_copilot_short %}. To use {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_windows_terminal %}, you must have an active {% data variables.product.prodname_copilot %} subscription. {% data reusables.copilot.subscription-prerequisite %} {% endif %}
- {% data variables.product.prodname_windows_terminal %} Canary. Terminal Chat is only available in {% data variables.product.prodname_windows_terminal %} Canary.
After you've installed {% data variables.product.prodname_windows_terminal %} Canary, you can use {% data variables.product.prodname_copilot_short %} in Terminal Chat to ask command line-related questions.
-
Open Settings from the dropdown menu.
-
Go to the Terminal Chat (Experimental) setting.
-
Under Service Providers, select GitHub Copilot and Authenticate via GitHub to sign in.
[!NOTE] {% data reusables.copilot.windows-terminal-access-denied %}
-
Open Terminal Chat (Experimental) in the dropdown menu.
-
In the Terminal Chat chat window, type
how do i list all markdown files in my directory
then press Enter.{% data variables.product.prodname_copilot_short %}'s answer is displayed below your question.
-
Click on an answer to insert it to the command line.
{% data reusables.copilot.quickstart-nextsteps1 %} {% data reusables.copilot.quickstart-nextsteps2 %}
{% endwindowsterminal %}
{% vscode %}
{% data reusables.copilot.quickstart-intro %}
Instructions for using {% data variables.product.prodname_copilot_short %} differ depending on where you are using it. This version of the quickstart is for {% data variables.product.prodname_vscode %}. Click the tabs above for instructions on using {% data variables.product.prodname_copilot_short %} in other environments.
{% ifversion fpt %} {% data reusables.copilot.quickstart-signup %} {% endif %}
{% ifversion ghec %}
- {% data variables.product.prodname_copilot_short %} subscription - To use {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vscode_shortname %}, you must have an active {% data variables.product.prodname_copilot %} subscription. {% data reusables.copilot.subscription-prerequisite %} {% endif %} {% data reusables.copilot.vscode-prerequisites %}
After you've installed the {% data variables.product.prodname_copilot %} extension, you can ask {% data variables.product.prodname_copilot_short %} coding-related questions.
[!NOTE] {% data reusables.copilot.chat-access-denied %}
-
Open an existing code file.
-
Open the Chat view from the Activity Bar.
-
At the bottom of the chat view, in the chat input field, type:
explain this file
. -
Press Enter.
{% data variables.product.prodname_copilot_short %} replies in the chat view.
-
In the editor, select one or more lines of code that are not commented.
-
In the chat input field, type:
add comments to these lines
. -
If you like the comments that {% data variables.product.prodname_copilot_short %} suggests, hover over the suggested code in the chat view and click the "Insert at Cursor" icon to replace the selected lines with the suggested code.
The following example uses JavaScript, however other languages will work similarly. {% data reusables.copilot.supported-languages %}
- Open {% data variables.product.prodname_vscode %}. {% data reusables.copilot.create-js-file %} {% data reusables.copilot.type-function-header %} {% data variables.product.prodname_copilot %} will automatically suggest an entire function body in grayed text. The exact suggestion may vary.
- {% data reusables.copilot.accept-suggestion %}
{% data reusables.copilot.quickstart-nextsteps1 %}
- Use {% data variables.product.prodname_copilot_short %} like a pro - Learn how to write effective prompts for {% data variables.product.prodname_copilot %}. For more information, see "Best practices for using {% data variables.product.prodname_copilot %} in VS Code" in the {% data variables.product.prodname_vscode %} documentation. {% data reusables.copilot.quickstart-nextsteps2 %}
{% endvscode %}
{% visualstudio %}
{% data reusables.copilot.quickstart-intro %}
Instructions for using {% data variables.product.prodname_copilot_short %} differ depending on where you are using it. This version of the quickstart is for {% data variables.product.prodname_vs %}. Click the tabs above for instructions on using {% data variables.product.prodname_copilot_short %} in other environments.
{% ifversion fpt %} {% data reusables.copilot.quickstart-signup %} {% endif %}
{% ifversion ghec %}
- Subscription to {% data variables.product.prodname_copilot_short %}. To use {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vs %}, you must have an active {% data variables.product.prodname_copilot %} subscription. {% data reusables.copilot.subscription-prerequisite %} {% endif %} {% data reusables.copilot.visual-studio-prerequisites %}
After you've installed the {% data variables.product.prodname_copilot %} extension, you can ask {% data variables.product.prodname_copilot_short %} coding-related questions.
[!NOTE] {% data reusables.copilot.chat-access-denied %}
-
Open an existing code file.
-
In the {% data variables.product.prodname_vs %} menu bar, click View, then click {% data variables.product.prodname_copilot_chat %}.
-
In the {% data variables.product.prodname_copilot_chat_short %} window, type
what does this file do
then press Enter.{% data variables.product.prodname_copilot_short %}'s answer is displayed below your question.
-
Select a line of code in the editor.
-
In the {% data variables.product.prodname_copilot_chat_short %} window, type
explain this line
then press Enter.
The following example uses JavaScript, however other languages will work similarly. {% data reusables.copilot.supported-languages %}
- Open {% data variables.product.prodname_vs %}.
- In {% data variables.product.prodname_vs %}, create a new JavaScript (*.js) file. {% data reusables.copilot.type-function-header %} {% data variables.product.prodname_copilot %} will automatically suggest an entire function body in grayed text. The exact suggestion may vary.
- {% data reusables.copilot.accept-suggestion %}
{% data reusables.copilot.quickstart-nextsteps1 %}
- Prompt like a pro - Watch "{% data variables.product.prodname_vs %} Prompt Engineering with {% data variables.product.prodname_copilot %}" on YouTube. {% data reusables.copilot.quickstart-nextsteps2 %}
{% endvisualstudio %}
{% jetbrains %}
{% data reusables.copilot.quickstart-intro %}
Instructions for using {% data variables.product.prodname_copilot_short %} differ depending on where you are using it. This version of the quickstart is for JetBrains IDEs. Click the tabs above for instructions on using {% data variables.product.prodname_copilot_short %} in other environments.
{% ifversion fpt %} {% data reusables.copilot.quickstart-signup %} {% endif %}
{% ifversion ghec %}
- Subscription to {% data variables.product.prodname_copilot_short %}. To use {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vs %}, you must have an active {% data variables.product.prodname_copilot %} subscription. {% data reusables.copilot.subscription-prerequisite %} {% endif %}
- A compatible JetBrains IDE. {% data variables.product.prodname_copilot_short %} is supported in a large number of JetBrains IDEs. For a full list, see "AUTOTITLE." {% data reusables.copilot.jetbrains-plugin-prerequisites %}
After you've installed the {% data variables.product.prodname_copilot %} plugin, you can ask {% data variables.product.prodname_copilot_short %} coding-related questions.
[!NOTE] {% data reusables.copilot.chat-access-denied %}
-
Open an existing code file.
-
Open the {% data variables.product.prodname_copilot_chat_short %} window by clicking the {% data variables.product.prodname_copilot_chat_short %} icon at the right side of the JetBrains IDE window.
-
In the {% data variables.product.prodname_copilot_chat_short %} window, type
what does this file do
then press Enter.{% data variables.product.prodname_copilot_short %}'s answer is displayed below your question.
-
Select a line of code in the editor.
-
In the {% data variables.product.prodname_copilot_chat_short %} window, type
explain this line
then press Enter.
The following example uses JavaScript, however other languages will work similarly. {% data reusables.copilot.supported-languages %}
- In your JetBrains editor, create a new JavaScript (*.js) file. {% data reusables.copilot.type-function-header %} {% data variables.product.prodname_copilot %} will automatically suggest an entire function body in grayed text. The exact suggestion may vary.
- {% data reusables.copilot.accept-suggestion %}
{% data reusables.copilot.quickstart-nextsteps1 %} {% data reusables.copilot.quickstart-nextsteps2 %}
{% endjetbrains %}