This article describes the GitHub Copilot tool and the main guidelines and assumptions regarding its use in software development projects. The guidelines concern both the tool’s configuration and its application in everyday work and assume the reader will use GitHub Copilot with IntelliJ IDEA (via a dedicated plugin).
GitHub Copilot is an AI developer assistant that uses a generative AI model trained for all programming languages available in GitHub repositories. The full description and documentation of the tool is available here.
There are other similar tools on the market, such as OpenAI Codex, JetBrains AI Assistant or Tabnine, but GitHub Copilot stands out due to the following features:
Our main goal for using GitHub Copilot was to improve the efficiency of writing code and its quality. In addition, we intended it to support and assist us in work in which programmers lack knowledge and experience. Here are the specific goals that we wanted our development team to achieve by using GitHub Copilot:
Since GitHub Copilot is based on generative AI, you must always remember that it may generate incorrect code or responses. Therefore, when using the tool, you must be aware of potential limitations and apply the principle of limited trust and verification. The main limitations are presented in the table below.
Limitation | Description |
Limited scope of knowledge | The tool is based on code found in GitHub repositories. Some problems, or complex structures, languages or data notations, have poor representation in the training sets |
Dynamic development and features in the beta phase | The tool is developing very dynamically. Patches and updates appear every week or every several weeks, which indicates that many elements of the tool are not working properly. Some functionalities, such as GitHub Copilot CLI, are still in beta |
Inaccurate code | The tool provider informs that the generated code may not meet the user’s expectations, may not solve the actual problem, and may contain errors |
Inaccurate chat responses | When using chat, the accuracy of the answer depends largely on the question or command formulated. The documentation says that “Copilot Chat is not designed to answer non-coding questions”, so there are possible answers, especially in areas not strictly related to the code (design, etc.), that will not be appropriate or even sensible |
Dangerous code | The training set (repositories) may also contain code elements that violate security rules, both in the security and safety sense, such as API keys, network scanning, IP addresses, code that overloads resources or causes memory leaks, etc. |
To minimize the negative impact of the identified GitHub Copilot limitations, you should always:
Important: Never deploy the code generated by GitHub Copilot to production environments without performing the above checks.
In this section, we’ll present the basic information regarding the pricing plans (with advantages and disadvantages for each option, as seen from the perspective of our intended goals) and personal account configuration (for both GitHub Copilot and the IntelliJ IDEA plugin).
GitHub Copilot offers three subscription plans with different scopes of offered functionality and cost. In our case, two plans were worth considering: Copilot Individual or Copilot Business. The Copilot Enterprise plan additionally offers access to chat via the github.com website and generating summaries for pull requests, which was unimportant for our assumed goals (but it may be different in your case). Both plans’ main advantages and disadvantages are presented in the table below.
Plan | Advantages | Disadvantages |
GitHub Copilot Individual | Lower cost at $10/month/user
Offers the key functionality required to achieve the intended goals |
Lack of control over tool configuration and user access by the organization |
GitHub Copilot Business | Offers the key functionality required to achieve the intended goals
Control over tool configuration and user access by the organization |
Higher cost at $19/month/user |
In our case, Copilot Business was the better option, especially because it allows full control over the configuration and access to the tool for developers in the team. If you’re working on your own, the Copilot Individual plan might be enough.
You can configure GitHub Copilot when purchasing a subscription plan, and the settings can also be changed after activating the account in the organization’s account settings on GitHub. At the account level, there were two key parameters for our use case to configure in GitHub Copilot, described in the table below.
Option name | Description | Recommended settings |
Suggestions matching public code | Available options:
Allowed and Blocked Determines whether to show or to block code suggestions that overlap around 150 lines with public code |
Blocked
This option reduces the risk of duplicating code from public repositories, thus reducing the uncertainty about the copyright ownership of the code |
Allow GitHub to use my code snippets for product improvements | Available options: Yes and No
Determines whether GitHub, its affiliates, and third parties may use user code snippets to explore and improve GitHub Copilot suggestions, related product models, and features |
No
If you plan to use GitHub Copilot for commercial purposes, GitHub and its associated entities should not use user code due to copyright considerations |
Here is a detailed description and instructions for changing configuration options in your GitHub account.
To enable GitHub Copilot in the IntelliJ IDEA IDE, you must install GitHub Copilot extension from the Visual Studio Code marketplace. Installation is done via the IDE in the plugin settings. After installation, log in to your GitHub account with your device code. You can find detailed instructions for installing and updating the plugin here.
The GitHub Copilot plugin for the IntelliJ IDEA IDE offers the ability to configure the following things:
In our case, using the default plugin settings was recommended because they ensure good working comfort and are compatible with the existing tool documentation. Any changes to the configuration can be made by each user according to their own preferences.
Here are some guidelines for using key functionalities that will help you use the GitHub Copilot tool optimally.
When to use:
How to use:
When to use:
How to use:
When to use:
How to use:
When to use:
How to use:
When to use:
How to use:
Command | Example | Result |
gh copilot suggest | # gh copilot suggest “find IP number in text file” | grep -E -o ‘([0-9]{1,3}\.){3}[0-9]{1,3}’ <filename> |
gh copilot explain | # gh copilot explain “curl -k” | curl is used to issue web requests, e.g., download web pages
–k or –insecure allows curl to perform insecure SSL connections and transfers |
We’ve written a separate chapter for the GitHub Copilot Chat – as there are several use cases worth talking about. Let’s go through them individually and discuss specific guidelines for each case.
When to use:
How to use:
When to use:
How to use:
When to use:
How to use:
When to use:
How to use:
When to use:
How to use:
The result:
As you can see, GitHub Copilot can be a powerful tool in a software developer’s arsenal. It can speed up and simplify various processes and day-to-day tasks. However, as with all things related to generative AI, you can never fully trust this tool – therefore, the crucial rule is to always read, review, and test what it creates.
If you’re interested in AI, we advise you to check out a couple of other articles on our blog regarding the possibilities offered by this technology:
Pretius has plenty of experience with AI tools and technologies – we’ve tried it for writing and reviewing code and analyzed whether it can be useful for testing automation. Moreover, we’ve already built some AI-based solutions for our clients. We’ll be happy to help you out. Reach out to us at hello@pretius.com or use the contact form below. You can expect an answer within 48 hours.
Here are answers to some common questions regarding GitHub Copilot.
GitHub Copilot is an AI pair programmer tool designed to help coders in their work. It suggests quick code completions. It’s also possible to use GitHub Copilot to generate code via natural language prompts.
Paid subscriptions start at $10/month.
There’s a 30-day trial for everyone, and a free GitHub Copilot subscription is available for verified teachers, students, and users who maintain popular open-source repositories on GitHub.
The solution works with various frameworks, but according to the documentation, you’ll get the best results with JavaScript, TypeScript, Ruby, Go, C#, and C++.
If you use VSC, create a new JavaScript file (with a .js extension) and type the function calculateDaysBetweenDates(begin, end) { function header. If the tool works as intended, you should get a suggestion for an entire function body, which you can accept by pressing the Tab key.
It’s fairly easy – simply open Visual Studio Code Marketplace, visit the Copilot extension’s page and click the install button. Then click, the GitHub Copilot icon in the bottom panel of the Visual Studio window.