How to use GitHub Copilot: What it can do and real-world examples

How Copilot can generate unit tests, refactor code, create documentation, perform multi-file edits, and much more.

|
| 13 minutes

Since the free version of GitHub Copilot launched last month, you’ve asked lots of questions, like “Is it free for everyone?” (Yes!), “Can Copilot make changes to multiple files?” (Yes again!), “What’s the name of Copilot’s mascot?” (It doesn’t have a name…yet.), and most of all: “What can GitHub Copilot actually do?”

The short answer is a lot. The longer answer covers a bunch of different use cases, workflows, coding languages, and much more, so it’s a good thing we have some space to talk about it!

We’ll update this list as GitHub Copilot continues to evolve and we add new, awesome features like we’ve been doing since we first launched it a few years ago.

Ready? Let’s go.

What is GitHub Copilot?

GitHub Copilot is a generative AI tool that functions as a coding assistant to help you write code faster and so much more.

One of the main advantages of Copilot is it draws context from your coding environment, open tabs, and your GitHub projects (including your pull requests, issues, discussions, and codebase). For example, you can ask Copilot Chat to provide a summary of code in a given repository or explain how pieces of code in your app work. In either case, it will provide an answer with the contextual knowledge of your project. You can also ask Copilot to help document, debug, and refactor code—all without the need to context switch or copy over large sections of code to another application.

GitHub Copilot is available for anyone to use with GitHub Copilot Free. If you want more advanced Copilot capabilities, we offer Pro, Business, and Enterprise tiers, too. With these options, you can pick the solution that works best for you. For your reference, we’ve included a section on the different access tiers.

How are developers using GitHub Copilot?

As GitHub Copilot capabilities continue to grow, developers are using it in a number of ways including:

  • Getting code completion suggestions while they type in the IDE
  • Asking Copilot Chat to explain how a section of code works
  • Generating tests and helping to fix code that fails a given test
  • Migrating code to a different language
  • Refactoring existing code
  • Explaining code you’re working with
  • Using Copilot Extensions to work with other applications and tools in your tech stack (you can even build a custom one)
  • Generating documentation to describe a set of changes in a pull request

What GitHub Copilot can do (and how to use it)

So, how can GitHub Copilot help you in your projects? Let’s jump in.

What’s new in GitHub Copilot

This is a living document, so we’ll update this section with the latest and greatest from Copilot as it continues to evolve.

Choose the AI model that powers GitHub Copilot

With GitHub Copilot, you can choose the model you want to work with. In Copilot Free you have access to Anthropic’s Claude 3.5 Sonnet and OpenAI’s GPT-4o models. And if you use one of the Copilot paid tiers, you’ll have more models to choose from to customize your experience.

In-line code completion

When coding, GitHub Copilot can offer coding suggestions directly in your coding environment. It can both provide code to complete what you’re currently working on or respond to natural language prompts to generate code. Developers often use this for generating boilerplate code and common coding snippets—such as the getter and setter functions of variables.

But Copilot isn’t limited to simple and repetitive code completion. Using Copilot Chat, you can tell it what you want it to do by describing the task in plain language or the /new slash command, it will then provide some code suggestions to help you get started.

💡 Pro tip: Getting the most out of this feature requires you to craft good prompts.You can learn more about effective prompting with GitHub Copilot in our documentation on prompt engineering.

Related posts

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant