Exercise: Getting Started with GitHub Copilot
Opened this issue Β· 2 comments
Getting Started with GitHub Copilot
π Hey there @hot33331! Welcome to your Skills exercise!
Welcome to the exciting world of GitHub Copilot! π In this exercise, you'll unlock the potential of this AI-powered coding assistant to accelerate your development process. Let's dive in and have some fun exploring the future of coding together! π»β¨
β¨ This is an interactive, hands-on GitHub Skills exercise!
As you complete each step, Iβll leave updates in the comments:
- β Check your work and guide you forward
- π‘ Share helpful tips and resources
- π Celebrate your progress and completion
Letβs get started - good luck and have fun!
β Mona
Step 1: Hello Copilot
Welcome to your "Getting Started with GitHub Copilot" exercise! π€
In this exercise, you will be using different GitHub Copilot features to work on a website that allows students of Mergington High School to sign up for extracurricular activities. π» β½οΈ βοΈ
What is GitHub Copilot?
GitHub Copilot is an AI coding assistant that helps you write code faster and with less effort, allowing you to focus more energy on problem solving and collaboration.
GitHub Copilot has been proven to increase developer productivity and accelerate the pace of software development. For more information, see Research: quantifying GitHub Copilotβs impact on developer productivity and happiness in the GitHub blog.
Your most common interactions will likely be:
- Inline suggestions: As you type, Copilot uses the nearby context to suggest code directly in your editor. This will be a familiar interaction if you have used code completion tools like Intellisense, except that the completions may be entire functions.
- Copilot - Ask Mode: A dedicated chat panel that lets you ask coding related questions. This will feel familiar if you have used online AI assistant chats. The big difference however, is that your project files will provide automatic context to provide tailored responses.
- Copilot - Edit Mode: Similar to Ask mode, but less conversational. Copilot will make changes to your selected files to implement your request.
- Copilot - Agent Mode: Copilot will run iteratively until it achieves your request. It will select context, make code changes, run terminal commands, run tools, and most importantly review its work to make adjustments.
Tip
You can learn more about current and upcoming features in the GitHub Copilot Features documentation. You can also select different models and make your own extensions, but that's for a different lesson!
How can I use GitHub Copilot?
As you work, you'll find GitHub Copilot can help out in several places across the website and in your favorite coding environments such as VS Code, Jet Brains, and Xcode! For today's coding though, we will practice with VS Code in a pre-configured development environment known as Codespace.
β¨οΈ Activity: Get a project intro from Copilot Chat
Let's start up our development environment, use copilot to learn a bit about the project, and then give it a test run.
-
Use the below button to open the Create Codespace page in a new tab. Use the default configuration.
-
Confirm the Repository field is your copy of the exercise, not the original, then click the green Create Codespace button.
- β
Your copy:
/hot33331/skills-getting-started-with-github-copilot - β Original:
/skills/getting-started-with-github-copilot
- β
Your copy:
-
Wait a moment for Visual Studio Code to load in your browser.
-
In the left sidebar, click the extensions tab and verify that the
GitHub CopilotandPythonextensions are installed and enabled.
-
At the top of VS Code, locate and click the Copilot icon to open a Copilot Chat panel.
-
If this is your first time using GitHub Copilot, you will need to accept the usage terms to continue.
-
Enter the below prompt to ask Copilot to introduce you to the project.
@workspace Please briefly explain the structure of this project. What should I do to run it?Note: It is not necessary to follow Copilot's recommended instructions. We have already prepared the environment for you.
What is @workspace?
Nice job noticing the details, but let's just use it for now. π€ We promise to explain in the next step. -
Now that we know a bit more about the project, let's actually try running it! In the left sidebar, select the
Run and Debugtab and then press the Start Debugging icon.
-
We want to see our webpage running in a browser, so let's find the url and port. If it isn't visible, expand the lower panel and select the Ports tab.
-
In the list, find port
8000and the related link. Hover over the link and select the Open in browser icon.
β¨οΈ Activity: Use Copilot to help remember a terminal command π
Great work! Now that we are familiar with the app and we know it works, let's ask copilot for help starting a branch so we can do some customizing.
-
If not already there, return to VS Code.
-
In the bottom panel, select the Terminal tab. On the right side, click the plus
+sign to create a new terminal window.Note: This will avoid stopping the existing debug session that is hosting our web application service.
-
Within the new terminal window use the keyboard shortcut
Ctrl + I(windows) orCmd + I(mac) to bring up Copilot's Terminal Inline Chat. -
Let's ask Copilot to help us remember a command we have forgotten: creating a branch and publishing it.
Hey copilot, how can I create and publish a new Git branch?Tip: This is a simple example, but Copilot is great at providing more tailored commands that might involve loops, pattern matching, file modification, and more! Don't be afraid to ask Copilot for a suggestion. Just remember it is a suggestion and you should always verify it first to be safe.
-
Copilot probably gave us a command like the following. Rather than manually modify it, let's respond back to tell Copilot to use a particular name.
git checkout -b {new_branch_name} git push -u origin {new_branch_name}Awesome! Thanks, Copilot! Let's use the branch name "accelerate-with-copilot".Tip: If Copilot doesn't give you quite what you want, you can always continue explaining what you need. Copilot will remember the conversation history for follow-up responses.
-
Now that we are happy with the command, press the
Runbutton to let Copilot run it for us. No need to copy and paste! -
After a moment, look in the VS Code lower status bar, on the left, to see the active branch. It should now say
accelerate-with-copilot. If so, you are all done with this step! -
Now that your branch is pushed to GitHub, Mona should already be busy checking your work. Give her a moment and keep watch in the comments. You will see her respond with progress info and the next lesson.
Having trouble? π€·
If you don't get feedback, here are some things to check:
- Make sure your created the branch with the exact name
accelerate-with-copilot. No prefixes or suffixes. - Make sure the branch was indeed published to your repository.


