GitHub Copilot is built into GitHub, so you can use it without installing anything.
This quickstart takes about fifteen minutes and shows how to ask questions about a repository, request and review a code change, and continue your work on GitHub Mobile with Copilot.
Prerequisites
- For Task 1, you need read access to a repository, such as the public github/docs repository.
- For Tasks 2 and 3, you need write access to a repository. We recommend using a repository that you own or have permission to make changes to.
- To complete each task in this quickstart, Copilot must be available for your account and enabled for the repository you will use. For setup guidance, see Enable Copilot.
- To perform Task 3, you need to have GitHub Mobile installed and set up for your account. See GitHub Mobile.
Task 1: Ask Copilot questions about a repository
-
Start a session with Copilot, from the Copilot home page.
-
Below the prompt box, open the Chat session scope picker.
-
Under Work in a repository, search for and select the repository you want to explore.
- If you need a repository to try, use the public github/docs repository.
-
If a specific file, issue, or pull request is relevant, type
@in the prompt box and select it from the suggestions. This gives Copilot a specific place to look for context. -
Ask a question about the repository. For example:
Copilot prompt I'm new to github/docs. How is this repository organized, and where should I start to understand how the site is built?
I'm new to github/docs. How is this repository organized, and where should I start to understand how the site is built?Copilot prompt In /package.json, which scripts look relevant for validating a change, and what command does each run?
In /package.json, which scripts look relevant for validating a change, and what command does each run?Copilot prompt What behavior does /src/color-schemes/tests/color-mode-script.ts cover? Suggest one additional test case that would fit the existing tests, and explain why.
What behavior does /src/color-schemes/tests/color-mode-script.ts cover? Suggest one additional test case that would fit the existing tests, and explain why.To create a prompt from the above examples, select Copy, and paste it into the prompt box. Then press Enter to send the prompt.
Copilot's answer appears in the conversation. Ask a focused question about a file, feature, or error to get a more useful answer.
-
Ask a follow-up question by typing it in the same prompt box and pressing Enter. The conversation gives Copilot context for your next question.
Task 2: Request and review a code change
-
Start a session with Copilot, from your Copilot home page.
-
In a repository where you have write access, use the Chat session scope picker and select the repository under Work in a repository.
-
Request a code change. State the result you want and any relevant file or behavior. For example, copy and send this prompt:
Copilot prompt Add a small ASCII art image to the top of the README file.
Add a small ASCII art image to the top of the README file.Paste the prompt into the prompt box and press Enter to send it. Copilot works on the task in the background.
Important
Review all Copilot requests for permissions or action, before allowing changes.
-
As Copilot works on the request, you can continue to interact with the session. You can also expand each of the steps Copilot takes in the session log to see the work performed and tools used.
-
When Copilot finishes, it will display the changes above the prompt box, and present an option to create a pull request.
-
Click Changes to view the proposed changes.
-
To make further changes, type a follow-up request in the same prompt box and press Enter. The session retains the context from your earlier prompts.
-
Click Create pull request, then click the View PR link to view your changes.
Proceed to Task 3 to continue your session in GitHub Mobile.
Task 3: Continue your session in GitHub Mobile
-
Open GitHub Mobile on your device.
-
From the home page, tap the icon in the bottom right corner of the screen.
-
Under the list of recent sessions, tap the name of the session you created above. The name is often based on the first prompt you sent. In this example, it may be something like
README ascii art. -
Click on View PR, and then Files changed, to review the proposed changes again.
-
Optionally, to request another change, click the affected line. Add a comment that mentions
@copilotand describes what to change. Then select Comment and click Finish your review so Copilot can see and act on your request.Copilot will acknowledge your comment with a reaction, and start a session to make the requested changes if possible. Timeline events on the pull request page will show when Copilot is finished, and Copilot will request your review again as well as reply to your previous comment with the results.
-
When you are happy with your pull request, you must Mark as ready for review.
-
Review the changes made by Copilot to ensure they meet your expectations. If needed, click Approve and then Finish your review, to bring the PR to a merge-ready state.
-
Click Merge to merge the pull request.
Next, let's check to see your updated README file.
-
Return to your Home on GitHub Mobile to search for your repository, and open it.
-
Scroll to the bottom of the page to view the repository's README, and admire your artwork!