32,39 €
Cross-functional product teams are under constant pressure to build and ship faster, but too much time is lost to manual coding, slow reviews, and fragmented workflows. GitHub Copilot streamlines day-to-day coding so your team can focus on delivering value to users while maintaining high quality on real projects.
Written by industry experts Rob Bos and Randy Pagels, this book shows how GitHub Copilot supports your work from start to finish. You’ll learn how to turn ideas into tasks, write code with fewer hiccups, spot problems earlier, and understand errors when things go wrong. You’ll also see how Copilot suggests improvements in pull requests and helps fix common build issues, enabling teams to keep moving and ship with confidence.
You’ll integrate GitHub Copilot into daily routines, share it across roles, and make it stick with simple checklists and clear examples. You’ll also track what works, set guardrails, and build an internal community.
By the end, you’ll know when GitHub Copilot helps – and when it doesn’t – and you’ll be ready to write, review, and ship code with confidence on real projects.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 354
Veröffentlichungsjahr: 2025
The GitHub Copilot Handbook
A practical guide to transforming the software development life cycle with GitHub Copilot
Rob Bos
Randy Pagels
The GitHub Copilot Handbook
Copyright © 2025 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Portfolio Director: Ashwin Nair
Relationship Lead: Nitin Nainani
Project Manager: Ruvika Rao
Content Engineer: Hayden Edwards
Technical Editor: Arjun Varma
Copy Editor: Safis Editing
Indexer: Pratik Shirodkar
Proofreader: Hayden Edwards
Production Designer: Vijay Kamble
Growth Lead: Anamika Singh
First published: November 2025
Production reference: 1311025
Published by Packt Publishing Ltd.
Grosvenor House
11 St Paul’s Square
Birmingham
B3 1RB, UK.
ISBN 978-1-80611-663-8
www.packtpub.com
When I started in tech 25 years ago, I worked in a data center surrounded by physical servers. Deployments meant walking up to a machine, tweaking configurations by hand, and hoping everything worked. Every step was manual, every mistake was personal, and every success felt like a small victory.
Over the years, I’ve seen our industry reinvent itself again and again, from bare metal to the cloud, from pagers to pipelines, from monoliths to microservices. But nothing has transformed how we build software quite like AI. GitHub Copilot has become more than a coding assistant – it’s a thinking partner. I’ve seen it write Terraform templates, generate PowerShell scripts, and help developers of all levels learn and move faster. It’s changing how we problem-solve, collaborate, and create.
AI isn’t here to replace us – it’s here to amplify us. It gives us space to focus on design, architecture, and innovation – the things that make engineering truly human.
That’s why I’m excited about this book from Randy Pagels and Rob Bos. They’ve both spent their careers helping developers work smarter, automate more, and embrace change. In these pages, they don’t just explain how GitHub Copilot works; they also show how it fits into the real world of modern development.
So, whether you’re just starting out or have decades of experience, I invite you to explore this next evolution with them. The future of software isn’t humans versus AI – it’s what we can build together.
April Yoho
Senior Developer Advocate and DevOps Specialist, GitHub
Rob Bos is a Microsoft MVP, GitHub Star, and trainer focused on DevOps, GitHub (Actions, Copilot, and Advanced Security), and team enablement. He empowers teams to work smarter with GitHub tools, automating processes, improving security, and driving value delivery through practical, hands-on learning. Rob speaks at conferences worldwide and shares his insights through blogs, courses, and workshops. For work, Rob is a DevOps consultant at Xebia, helping customers with their DevOps culture.
Randy Pagels is a principal trainer at Xebia USA and a former Microsoft veteran with 17+ years of experience. He designs and delivers hands-on GitHub Copilot, Actions, and AI training. Randy is known for his engaging teaching style, practical scenarios, and commitment to helping teams scale AI adoption confidently and effectively. He also speaks at developer conferences and industry events throughout the year.
Mickey Gousset is a staff DevOps architect at GitHub. He is passionate about helping developers achieve their goals, whether that’s through his work or by creating content on his YouTube channel.
Welcome to your learning journey using GitHub Copilot for coding-related engineering tasks. We are excited to show you around its toolset and how it extends our normal workflows.
GitHub Copilot is having a profound impact on the tech industry, from helping engineers implement code changes faster to helping stakeholders and product owners describe their requirements more easily. It does not matter how much experience you have with coding – GitHub Copilot provides help to everyone, supporting all phases of the software development lifecycle. That makes it easier to generate code changes, add tests to it, and write the deployment pipelines. Want to discover more about coding practices? GitHub Copilot is your peer programming helper that can explain it all to you.
Leveraging the foundation language models such as GPT-5, Gemini, Claude Sonnet, and more, GitHub has added specific features in lots of smart places in your favorite editors, including VS Code, Eclipse, Visual Studio, JetBrains IDEs, and more. Next to that, there is a realm of additional support on GitHub.com, where the engineering process happens: from general research to issue creation, to adding code, making a pull request, and helping with debugging your pipeline issues. GitHub Copilot has integrations with all these steps into the developer workflow.
Join us to learn all about GitHub Copilot, as we guide you through the learning curve that the authors have used to train thousands of engineers over the last few years.
This book is for anyone who works with application creation and who wants to harness GitHub Copilot in real-world coding environments. Whether you’re a beginner looking to speed up learning or a seasoned engineer aiming to boost productivity, this guide shows how to put Copilot to work effectively.
Software engineers, DevOps professionals, QA specialists, and tech leads will discover how to streamline coding, reviews, and delivery with AI-assisted workflows. Product managers and other collaborators will also gain insight into how, with GitHub Copilot, they themselves can leverage AI.
Chapter 1, GitHub Copilot Explained, provides an overview of GitHub Copilot and its features, from suggestions to the Chat interface, and shows how they impact our day-to-day engineering process.
Chapter 2, Getting Started with Generative AI, offers a foundation for understanding what generative AI is and what it is not – from the basics of language models to how these features are applied to the engineering process.
Chapter 3, Choosing the Right GitHub Copilot Plan, outlines the different subscription options you have for GitHub Copilot and why you would choose one over the other.
Chapter 4, Mastering GitHub Copilot in Your IDE: Inline Suggestions, Chat, and Agent Mode, dives into the features of GitHub Copilot in your favorite editor.
Chapter 5, Beyond Code: Debugging, Terminal, and Collaboration with GitHub Copilot, covers the next steps after learning about the main features of the tools and shows you the smart integrations into the rest of the development process.
Chapter 6, Collaborating with GitHub Copilot on GitHub.com: Issues, PRs, Reviews, and Coding Agent, teaches you about the powerful features built into the web interface on GitHub.com, such as collaboration on issues and pull requests, as well as triggering the coding agent to let GitHub Copilot create the code changes needed to implement the requested functional updates.
Chapter 7, Extending GitHub Copilot with the Model Context Protocol (MCP), shows how the MCP servers add extra context to your Chat interface in agent mode, so that you can read and write into external systems.
Chapter 8, Navigating the GitHub Copilot Learning Curve, talks about the learning curve that GitHub Copilot has, as this is more than just a new tool for your toolbelt. We show how to address the learning curve so that you and your team members can get the most out of GitHub Copilot.
Chapter 9, Building an Internal GitHub Copilot Community, explains how we humans learn the best from seeing other people work with the tools we have, and how you can build an internal community around GitHub Copilot to continuously educate yourself and unlock the next level of proficiency.
Chapter 10, Changing the Narrative: Reframing Engineering with AI, discusses using AI in your engineering processes as a complete rewire of our own muscle memory, and how to approach this new way of thinking about getting the most benefit out of GitHub Copilot.
You need the following for this book:
A basic understanding of the software development life cycleSome experience using coding editors to work with your code baseUsage of GitHub.com with issues and pull request processesThere are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and X/Twitter handles. For example: “You can use /explain #symbol to ask for an explanation of only the function or symbol under your cursor, not the entire file.”
A block of code is set as follows:
test('generates password of correct length', () => { expect(generatePassword(10)).toHaveLength(10); });Bold: Indicates a new term, an important word, or words that you see on the screen. For instance, words in menus or dialog boxes appear in the text like this. For example: “Under Permissions, click Add permissions, then select Copilot Requests.”
Warnings or important notes appear like this.
Tips and tricks appear like this.
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book or have any general feedback, please email us at [email protected] mention the book’s title in the subject of your message.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you reported this to us. Please visit http://www.packt.com/submit-errata, click Submit Errata, and fill in the form.
Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit http://authors.packt.com/.
Once you’ve read The GitHub Copilot Handbook, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.
Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.
This book comes with free benefits to support your learning. Activate them now for instant access (see the “How to Unlock” section for instructions).
Here’s a quick overview of what you can instantly unlock with your purchase:
PDF and ePub Copies
Next-Gen Web-Based Reader
Access a DRM-free PDF copy of this book to read anywhere, on any device.
Multi-device progress sync: Pick up where you left off, on any device.
Use a DRM-free ePub version with your favorite e-reader.
Highlighting and notetaking: Capture ideas and turn reading into lasting knowledge.
Bookmarking: Save and revisit key sections whenever you need them.
Dark mode: Reduce eye strain by switching to dark or sepia themes.
Scan the QR code (or go to packtpub.com/unlock). Search for this book by name, confirm the edition, and then follow the steps on the page.
Note: Keep your invoice handy. Purchases made directly from Packt don’t require one.
In the first part of the book, we are going to take a broad look at what GitHub Copilot is, what kind of features you can expect, and where the integration points with the GitHub platform are. You’ll see that GitHub has thoughtfully added features in the places of the software development lifecycle where it makes sense for engineers: from integration into the editor all the way to right into the interfaces on github.com.
To get a good grasp of the underlying technology that powers GitHub Copilot, we will also take a look at what generative AI is, its basic features, as well as where it strengths and weaknesses are. This forms the foundation of having the right expectations of the power of GitHub Copilot and how important having access to the right context for your conversations is.
We will close this part by showing the different ways to get access to GitHub Copilot, from the subscriptions tailored for individual users all the way to GitHub Copilot in a professional business setting.
This part of the book includes the following chapters:
Chapter 1, GitHub Copilot ExplainedChapter 2, Getting Started with Generative AIChapter 3, Choosing the Right GitHub Copilot PlanGitHub Copilot is a service offering from GitHub that helps you to work on your applications in all steps of the software development lifecycle: from ideation, to understanding and writing code, to reviewing your pull requests and analyzing pipeline failures. By using what we call generative Artificial Intelligence (AI), it helps you speed up normal tasks so you can focus on what you do best: adding value to your end users.
GitHub describes Copilot as your pair-programming buddy: a tool that knows almost every coding language, framework, and well-known coding patterns. It can help you with researching both existing and new code directions, can help review your code and suggest improvements, or can complete the task that you have been working on. It intuitively understands your current code and coding style and will follow that to match it. We even think that GitHub Copilot is better than a human pair-programming buddy, as it is a tool that does not judge you on anything you ask about! Can’t remember how to implement an algorithm that you learned years ago? You might be afraid to ask your team members about it, but GitHub Copilot will happily explain it to you – plus, it will explain it in the context of your code base!
Keep in mind that the name of the tool also gives away the most important part of its role in your usage of it: it is a co-pilot, which means you are the pilot, and you are in control. You define the questions you ask it; the scenarios you let it complete; the help you ask it for; and whether you accept the suggestions or not. In the end, the code is stored in a Source Code Management (SCM) system with your name attached to it, not GitHub Copilot’s name.
This book will take you through the impact that GitHub Copilot has on all steps of the Software Development Life Cycle (SDLC), from start to finish. We will explain the features of the tools, the basics of generative AI, and how to leverage GitHub Copilot to get the most value out of it. We will also discuss the different license types that are available and what features they have for either usage in your editor or on the web interface for GitHub.
To get things going, we will take a look at what GitHub Copilot is and what kind of features it provides. It all started as an extension in your coding editor, and it has grown into a full set of features to help you, from writing code to generating completely new ideas, from analyzing pull requests to helping you fix your pipeline errors, and so much more. These features are built into a lot of editors, and some reside inside the web interface on GitHub.com.
In this chapter, we will cover the following topics:
What is GitHub Copilot?Reviewing additional supporting features in editorsUsing GitHub Copilot integrations on GitHub.comYour purchase includes a free PDF copy of this book along with other exclusive benefits. Check the Free Benefits with Your Book section in the Preface to unlock them instantly and maximize your learning experience.
To use GitHub Copilot, you do not need to use the rest of the GitHub suite of tools. You can use it in a supported editor of your choosing against any file, no matter where it is stored. If you already use source control systems such as GitLab, Azure DevOps, or Bitbucket, you can still use GitHub Copilot. GitHub is the vendor of the product, but using GitHub itself is not a requirement.
Of course, there is extra functionality available if you use GitHub, which will be explained in depth in Chapter 6. The only integration to be able to use GitHub Copilot is having a GitHub account that you can use to log in and then tie your GitHub Copilot license to it. This tool is even available as a free tier (with some limitations), making it available for all GitHub users. Which features are available in which tier is explained in Chapter 3.
GitHub Copilot is a set of tools that can help you understand or produce code, either by helping you write code in an editor, talking to your code base to gain more information, or getting help from integrated functionality inside the web interface of GitHub.
This all starts with GitHub Copilot leveraging Large Language Models (LLMs) to complete the current line(s) of code that you are working on, by adding a suggestion when you stop typing for a couple of milliseconds, or when you hit the Return key. Depending on your color scheme, a suggestion is shown in gray or dimmed text in the editor, behind your cursor. You can see this in Figure 1.1, where the cursor is on line 9. This is also called “ghost text.” This text is a continuation of the code you already typed, and GitHub Copilot finds the most logical completion of the code and suggests it for you to accept.
Figure 1.1: Example of “ghost text” inside of VS Code
Accepting the code is as simple as hitting the Tab key, and the ghost text will be inserted at your cursor. The cursor will be moved to the end of the text that was inserted. Depending on what you were doing and how confident GitHub Copilot is in the suggestion, you can get either a word, a complete line, or multiple lines of code. It is then completely up to you what you want to do with that suggestion: you can use it as was proposed, you can accept parts of it, or you cannot accept any of it. What we also see is that people read the suggestions and then revise either the direction they were going in or the surrounding code based on new insights.
As well as the suggestion functionality, GitHub Copilot has chat integration, where you can have a conversation with the tool about the currently open files. See Figure 1.2 for an example:
Figure 1.2: Example of a chat conversation with GitHub Copilot
In the chat interface, you can ask anything you can think of – here are some examples:
What the major elements of the current open code base areHow you can execute the tests that exist in your projectTo find missing edge cases in your test suiteCreate your pipelines for you in any Continuous Integration/Continuous Deployment (CI/CD) system you needThe possibilities are endless and entirely up to you. The chat interface is a great way to engage with your code. It does not matter whether you are a developer who is just getting started or an experienced engineer: GitHub Copilot offers something for everyone.
We find it especially helpful if you are new to a code base, where GitHub Copilot can help you quickly find your way around the parts that you want to take a look at. Another great use case is when working in a development language that you are not that familiar with: we started contributing to code written in coding languages we did not use before, because GitHub Copilot helps us understand how those languages work. If you understand the basics of programming, such as if statements, for loops, and arrays, you can get very far very fast with GitHub Copilot. Even if you do not fully understand these basics, if you have an exploratory mindset, GitHub Copilot can help guide you through this new environment in a pragmatic way:
You can ask it to explain these features to you, and it will happily take you through these concepts step by stepYou can quickly find your way around the new code base by asking for an explanation of where the entry point is or how to build the applicationYou can let GitHub Copilot explain the application by using diagrams to place the components in the right places for you, so you can quickly learn about the integration points between the backend and frontendSince GitHub Copilot is that non-judgmental pair programming buddy that can help you with super basic tasks as well as more complex coding concepts, the chat function is a great tool for both people who are new to the field of coding, as well as for experienced engineers, and everything in between.
Having a basic understanding of the underlying technology of generative AI is paramount to having realistic expectations of what value these tools bring to the table. Knowing how GitHub Copilot produces code is explained in Chapter 2. With that knowledge, even more junior engineers can use GitHub Copilot to their advantage in researching and explaining coding concepts in the context of the current code base, where they can pick apart these concepts one by one. Since they understand that they need to double-check what GitHub Copilot produces, they can safely validate their own knowledge and grow their coding skills over time. Normal coding practices still apply, where we guide these engineers through the programming landscape and review the code they produce with that mindset, so they can grow in a safe manner. All this applies equally well to other non-technical stakeholders.
While suggestions and chat are the main functionalities that GitHub Copilot offers in most editors, some editors have even more functionality included. There are editors that offer, for example, an in-line chat functionality (see Figure 1.3) to directly edit a piece of code inside your text editor window. This feature lets you directly interact with your code in the place that you are editing, and it will directly apply the suggestions it is proposing with an inline overview to show the differences from your code.
Figure 1.3: Example of an in-line chat conversation
Other editors have deep integrations with their own features; for example, some editors leverage their debug functionality to view the runtime values of your variables during test execution, or can view the statistics of your performance tests. The common convention is to look for a “magic” icon that indicates GitHub Copilot can do something at that location or functionality in the editor. See Figure 1.4 for an example where GitHub Copilot generates a git commit message based on the current set of files that were changed.
Figure 1.4: GitHub Copilot integration in the git commit window
Now we have seen a brief overview of the main functionalities that GitHub Copilot adds to your editor – including suggestions while you type, chat with your code, and inline chat to create inline changes – as well as some features available in other editors. In the next section, let’s take a closer look at which editors support which of these additional features on top of the main functionalities.
The primary use case of GitHub Copilot is helping you with your code base while you are creating code. This is done by integrating the different functionalities in an existing Integrated Development Environment (IDE). This is often also referred to as an “editor.” You work on your code inside the editor to add new methods and features to your application or scripts that you are working on.
The list of IDEs that have a plugin for GitHub Copilot is still growing. Currently, the following editors have some support for GitHub Copilot:
Editor
Suggestions
Chat
Other features
VS Code
Yes
Yes
Yes
Visual Studio
Yes
Yes
Yes
JetBrains IDEs
Yes
Yes
Yes
Vim/Neovim
Yes
No
No
XCode
No
Yes
No
Eclipse
Yes
Yes
No
Figure 1.5: Overview of the three types of features per editor
Depending on the editor, certain features have been built in that work specifically for that editor, where we see the teams that create them learn from each other and sometimes rebuild great features in a way that works for their editor setup. One example is the deep integration that Visual Studio has with its Performance Profiler to give GitHub Copilot additional context during these performance-tuning sessions: a feature that the other editors do not have.
Alongside editors, there are also additional integrations into the GitHub Desktop tool that let you work with any Git repository, no matter the source control system you are using:
The Pull Request (PR) extension for VS Code has integrations with GitHub Copilot to write the PR title and description, and even the option to review the changes in the PR using AI.There is even a GitHub Copilot Command Line Interface (CLI) available to ask questions and let GitHub Copilot make the necessary changes to your code base, straight from the command line. We dive into the CLI in Chapter 5. Plus, there is even an open source GitHub Copilot language server available, which lets anyone build GitHub Copilot into any client if they use the GitHub Copilot license to authenticate users.That means the possibilities to include GitHub Copilot are endless.
Each editor plugin is often built by a different team from either GitHub or Microsoft (as they own VS Code and Visual Studio). The GitHub Copilot features for VS Code are open source and directly integrated into the open source code base in the VS Code repository! You can find the repository at https://github.com/microsoft/vscode and follow along with their iteration planning. Since VS Code is Microsoft’s main editor these days, with support for a lot of languages and tools, we often see that new features first appear in VS Code. It is the editor where things are tried and tested out first.
As the normal test versions of VS Code are in the Insiders release, following and using the Insiders release is the best way to see new features in action before the broader audience gets access to the formal releases. You can download and install the Insiders version for free from https://code.visualstudio.com/insiders. VS Code follows a regular release cadence of a new release version every month. The plugins are versioned separately and get multiple updates throughout the month.
The editor that usually gets new features after VS Code is Visual Studio, although sometimes the Visual Studio team has great ideas that they add first to Visual Studio, and then the VS Code team implements them as well in a later stage. Eventually, the functionality shows up in most other editors as well, where it makes sense or is possible. Editors such as Vim/Neovim only have a minimal user interface, and thus GitHub Copilot can only work with suggestions, as there is no place to show the chat interface. Visual Studio usually has a new release every three months. The plugins are versioned separately and can be released multiple times during the main release window.
IDE features are explained in depth in Chapter 4.
At this point, we have taken a look at additional tools available outside of editors, such as the extension for the GitHub CLI and the integration into GitHub Desktop. We have seen that different editors follow a different update cadence, which impacts when a specific feature might be added to your editor of choice, or even if that happens at all. In the next section, we will take a look at the additional features that are available on the GitHub.com platform when you have your code stored in it.
If you are using parts of the rest of the GitHub suite of products, then you can greatly enhance that experience with tooling from GitHub Copilot as well. After logging into https://github.com, you can start chatting with GitHub Copilot on top of any repository (see Figure 1.6) or open it in an immersive window to chat without the context of a repository. This is great for researching things and having a separate, contextless window to the side to quickly look up things while you are working. Need to look up how to install packages in a specific package manager? Then this chat window is the right place to ask about it. Personally, we have this tab open in our browser all the time.
Figure 1.6: Chat on the GitHub interface
Next to the chat, you will also find GitHub Copilot integrations in a lot of places on the web interface. Following the steps in the SDLC, it starts with researching new features you want to build and planning that work. GitHub Copilot can help you with both. The chat interface has a feature to create an issue in a repository, just by telling GitHub Copilot that you want to. It will then propose the issue title and text, with all the requirements you have been gathering in the chat conversation. This is great for researching where the touchpoints of the new feature in your application are, and for finding more context to base the issue’s description on. You can then instruct GitHub Copilot to create the issue in the repository, and it will do that for you, using your GitHub login. This will also make sure the issue contribution is linked to your user for future tracking and attribute the work you have done with GitHub Copilot to you.
There are also integrations when you start creating an issue, to bring in, for example, context from pipeline runs, or code scanning alerts, and allocate the places in your code base where the changes need to happen or will have an impact. The better the level of information in your issue, the easier it is for an engineer (or even GitHub Copilot!) to start working on implementing the necessary changes.
And yes, you read that right: GitHub has the functionality now to assign an issue directly to GitHub Copilot and let it try to implement the needed changes for you! It will attempt to figure out what steps to take and implement the changes, validate it with a build and or test run, and then create a pull request for you to review.
Plus, if you need to create a pull request by hand, GitHub Copilot can help you write the title and the pull request body based on the changes for you. It summarizes the changeset and will give you a verbose description of what the changes are, where they impact the application, and even annotate the description with the file and line location of the relevant changes. See Figure 1.7:
Figure 1.7: Example of a pull request summary generated by GitHub Copilot
The top sentence was the description of the engineer, and everything below the line was generated by GitHub Copilot. Notice the clear explanation and the inclusion of references to the changes in the GitHub Copilot version. This is great for getting better pull request information, as that is something that a lot of engineers are notoriously bad at. We always admire the level of detail in these summaries, as they are more descriptive of the changes than when we create these descriptions ourselves.
After the pull request is created, there is an integration to have GitHub Copilot automatically review the proposed changes for things such as errors, maintainability, typos, and more. It will annotate the pull request with feedback, and it even creates suggestions that you can incorporate into your application with a single click. This saves a lot of review time to find the low-hanging fruit during the review process, so that your team members can focus on things such as checking for completeness, fit with the application’s architecture and design, and so on.
If the pull request gets annotated by security scans such as Code Scanning results (part of GitHub Advanced Security), GitHub Copilot can review the findings and propose fixes right on the pull request feedback. This lets you quickly resolve common coding issues before they become a problem in production, right from the PR interface. This feature is called GitHub Copilot Autofix, which you can see in Figure 1.8:
Figure 1.8: Result of Copilot Autofix
Another integration that shows the deep connection between GitHub Copilot and the rest of the GitHub suite of tools, is the integration into GitHub Actions: when a workflow (pipeline) run fails, there is a button to start a chat session with GitHub Copilot and look at the error together, map it with the information it has on your repository, and then propose the reason why the workflow failed and propose a fix. You can then create a new issue and plan the work to be done, right from the chat interface!
These integrations on GitHub.com are explained in depth in Chapter 6.
Now we have seen an overview of the different integrations that GitHub Copilot has on the web interface of GitHub. From a generic chat to ask common coding questions to creating issues and working with pull requests, GitHub Copilot is integrated in all places in an engineer’s day-to-day process, where it makes sense.
In this chapter, we discussed the functionalities that GitHub Copilot offers so that we can place them in the right context, from integrations into your editor of choice to integrations on the web interface of GitHub. This is not bound to only the GitHub suite of tools, as it is offered in different IDEs from third-party vendors. You can use GitHub Copilot against any code file, no matter where it is stored. Your code does not need to be stored on GitHub at all if you do not want to.
We looked at the main IDE features, such as coding suggestions while you type, the chat interface, and inline chat. Keep in mind that not all editors offer the exact same features, so look at editors’ or plugins’ documentation for more specific information. In the web interface on GitHub.com, there are features that will help you throughout the entire SDLC: from requirements engineering to creating an issue to the creation of pull requests, there are integrations with GitHub Copilot to help you add value to the software that you are working on.
In the next chapter, we will take a look at how GitHub Copilot produces all the suggestions and chat answers that you ask it for. Having a good understanding of the basics of generative AI is important to have a realistic understanding of where tools help and where they have shortcomings. That will set you up for real understanding so that you do not view these tools as magic black boxes and instead become a power user who can put these tools to use where they shine!
Scan the QR code (or go to packtpub.com/unlock). Search for this book by name, confirm the edition, and then follow the steps on the page.
Note: Keep your invoice handy. Purchases made directly from Packt don’t require one.
Before we dive into the features and applications of GitHub Copilot, we want to make sure you have a basic understanding of the underlying technology. Having a grasp on the mechanics of generative AI gives you a solid foundation to have realistic expectations of what these tools can do for you and where they shine and where they have shortcomings. This understanding prevents disappointment when the technology doesn’t deliver the value you might have been expecting, something we have seen during the many training sessions and hackathons we have delivered. It also sets the right context for the things generative AI does not work so well with, as there are definitely some rough edges in its current state.
However, keep in mind that things are evolving fast, because the models, our understanding of working with models, and chaining features together, are all improving over time. This field has been rapidly accelerating over the last few years, jumping forward in leaps and bounds.
This chapter explains the core concepts surrounding generative AI, where it is most utilized, and where the rough edges are. This is because it’s important to remember that generative AI is not a black box that is embedded with all the world’s factual knowledge, so it will not magically take over all your coding work. The better you understand this, and therefore the limitations, the better working with generative AI is, and the better the results will be as well, growing from expecting magic into tuning your usage to the right level of detail and gaining leaps of improvement in your own coding flow.
In this chapter, we will dive into the following topics:
Understanding generative AIUtilization of generative AILimitations of generative AIGenerative Artificial Intelligence (AI) is the group name for the latest iterations of Machine Learning (ML). In the field of ML, you process large amounts of data to learn about the patterns in your data. This results in a trained model that can then be used to recognize these patterns or to predict certain values based on new parameters. The training data can be anything that is digitally available, from text to audio to images or video, and these models can be trained with all of it. Models trained on this type of textual data are called language models, as they can refer to concepts that can be expressed in natural (spoken) language.
GitHub Copilot uses these models to handle specific tasks. The two types of media that are supported by GitHub Copilot are text and images. The focus is on text, as that is how we write or document our code. However, images can also be used in the chat interface with models that support them. You might add an image to your question, and the model will try to describe what is visible in the image. The question that you ask is called a prompt. The language model then uses the prompt and other information that you shared (such as the image) to predict what it needs to respond with. That response will then be part of your conversation as well, and you can use that information in the follow-up questions.
You can see an example in Figure 2.1, where we added the image on the left to the chat context and asked GitHub Copilot to describe it. As you can see, a good description of the image has been provided.
Figure 2.1: Chatting with an image as extra context
In the following subsections, we dive into the different types of language models that we know and how these are used for text prediction tasks. We will also look at system prompts and see that the size of the information we send to the model has an impact on the accuracy of the result.
When we talk about language models, we always refer to the size of the data that the models were trained on, as that is an indicator of the type of tasks that they could be a fit for – the more data that the model has been trained on, the more generic the model is. The training data itself consists of terabytes and terabytes of data coming from different sources and in different formats and languages (both natural language and coding languages). This also leads to the naming concept of Large Language Models (LLMs).
There are also Small Language Models (SLMs) around that were trained with smaller amounts of data. Alongside that, there are models that are more focused on a specific topic group or on a specific type of task. They tend to perform better than larger models on that specific task and can therefore be chosen when working on that same type of task. These models are referred to as specialized models.
Using large amounts of training data also means that training these models can be very costly, as there is a large amount of computational power involved in the training phase. Those costs are up in the millions, ranging from 1 to 100 million US dollars. That also means that companies that train these models only train the model once and then use the trained model from then on. Only when a new technological improvement happens, or there is a need to retrain to have access to the latest available data, will a model be retrained. That is why all those models are also labeled with a version that indicates their order in the timeline compared to other model releases. Every vendor follows their own setup and definition for these. They also differ in the way they train their models, the data that the model is trained on, and so on. The vendors compete with each other
