GitHub Copilot Introduction, an AI-assisted Coding
Last Updated on January 2, 2025
GitHub Copilot is one of the most interesting tools released by GitHub. It was initially announced on June 29, 2021, and released later that same year on October 29. Copilot is an AI-assisted pair programmer that helps write code more quickly and efficiently. The tool extracts context from comments and code to provide quick suggestions for individual lines and even whole functions. On paper, this concept looks promising. AI-assisted programming is a huge step forward in terms of lowering the barrier to entry into programming.
However, it may not be advanced enough to supply the greatest coding practices right now. Users should always review the suggested code to guarantee security. In this article, you will get to know basic information that should help you understand how GitHub Copilot works and how it may be beneficial for you.
What is GitHub Copilot and how does it work?
To start off, OpenAI Codex is a natural language processing (NLP) AI model. It is developed by OpenAI, using the OpenAI GPT-3 architecture. However, unlike GPT-3, Codex was purpose-built for programming, rather than conversational text generation; and it is the technology that powers GitHub Copilot. It was trained to comprehend both programming and natural language using publicly available sources. The training data does not include any private repos – only the public ones. In simple terms, GitHub Copilot decreases the workload of developers by automating simpler tasks, and therefore allowing devs to focus on their primary or more complex tasks. The main functionalities that this tool has to offer include:
- code generation based on user’s descriptions and/or comments
- auto-filling for repetitive code
- support with simplifying writing tests using automation
- instant feedback & code reviews to spot bugs and fixes
- decreased developer workload, and potentially improved productivity
- extensions for third-party tools
GitHub AI supports a wide range of frameworks and programming languages. The list of supported languages includes: JavaScript, TypeScript, Python, Java, Ruby, and Go (Golang), C, C++, C#, PHP, Shell Scripting (Bash), HTML, CSS, Markdown, Kotlin, and Swift. However, the list goes on, and GitHub Copilot can help with more specialized use cases e.g. SQL support for generating database queries. The wide scope of supported languages makes GitHub Copilot useful for many areas of programming – from frontend development to building mobile apps. It also makes it accessible for devs on practically any skill level. It’s important to note that Copilot’s performance is best with the most common languages.
Available GitHub Copilot plans
As of December 2024, GitHub has officially released a free plan for Copilot. Before this, free access was only available to verified students, teachers, and open-source maintainers. Otherwise, there was a monthly fee starting at $10 a month. Since it’s mainly for devs who are getting started with Copilot, the feature set is more limited than other plans. The main restrictions of this plan include 2,000 code completions limit per month, not just accepted ones – all of them. Also, unlike the paid plans, the free one does not let you switch between foundation models, you are limited to Anthropic’s Claude 3.5 Sonnet and OpenAI’s GPT-4o.
Well, there are 4 plans that you can choose from: Free, Pro, Business, and Enterprise.
Free | Pro | Business | Enterprise | |
Pricing | $0 | $10 | $19 per user / month | $39 per user / month |
Interactions and messages with Chat | Up to 50 | No limit | No limit | No limit |
Code suggestions in real time | Up to 2000 | No limit | No limit | No limit |
Summaries for pull requests, issues, and discussions (AI) | No | Yes | Yes | Yes |
Code review in GitHub | No | Yes | Yes | Yes |
User management | No | No | Yes | Yes |
SAML SSO | No | No | Yes | Yes |
IP indemnity | No | No | Yes | Yes |
GitHub Copilot is available as an extension in three different development environments.
Here’s how to get started in each one of them:
GitHub Copilot for Visual Studio Code
You must first install the Visual Studio Code plugin before you can utilize GitHub Copilot. After the extension is installed, open the Visual Studio Code. When you sign in to GitHub, you’ll be asked to authorize the extension. For that, you will need a subscription. Then, you’ll be sent back to Visual Studio Code once you’ve authorized the plugin, and your setup is completed.
GitHub Copilot for JetBrains
The extension is confirmed to work with JetBrains IDEs such as IntelliJ IDEA, PyCharm, WebStorm and other JetBrains IDEs. It is recommended to use the latest version of your IDE for compatibility with the plugin itself and access to the newest features. Look for ‘github copilot’ on the JetBrains marketplace. Click the ‘Install’ button and accept the Third-Party Plugins Privacy Notice. Then, restart your IDE in order to apply the changes. After this operation is completed, the GitHub Copilot tool will be visible in the menu.
In an external browser, follow the prompts to log in to GitHub Copilot using the device auth flow and authorize the GitHub Copilot IntelliJ plugin using your GitHub account. Now, you should be able to start coding with the support of GitHub Copilot.
GitHub Copilot for Neovim
Start by installing Node.js 18 or above, along with the Neovim 0.6 or newer. Vim-plug, packer.nvim, or any other plugin manager can be used to install github/copilot.vim. Start Neovim and invoke :Copilot setup.
File content, both in the file you’re editing and in nearby or related files, is used by GitHub Copilot to provide suggestions. Contents used for generating suggestions include analyzing comments, function names, and existing code. When you use GitHub Copilot, it may additionally gather repository or file path URLs to find relevant context.
How good is it?
GitHub Copilot gives you the possibility to cycle through alternative recommendations, accepting or rejecting them on the spot or adjusting the lines. The developer is always in control. Copilot is said to be learning from made modifications and adapts to personal coding style. GitHub reported about running tests against a group of Python functions that have good test coverage in open source repositories. The function bodies were left blank and GitHub Copilot was tasked with filling them up. On the first try, the model got it right 43% of the time and 57% of the time when given 10 attempts.
Extension tries to comprehend your purpose and create the best code it can, but the lines it offers may or may not function or make sense. As it becomes smarter by the day, any suggestions should be thoroughly tested, reviewed, and verified, just like any other code. GitHub says It works best if the developer breaks code down into discrete functions, gives function arguments meaningful labels and comments on the go. It also seems to perform best when guiding through new libraries or frameworks.
GitHub Copilot gives you the possibility to cycle through alternative recommendations so that you can accept, reject, and modify them on the spot. This way the developer is always in control of the code.
Copilot is said to be learning from the modifications made by the user and adapting to personal coding styles over time. GitHub actually reports that since its release, Copilot helped devs code up to 55% faster. Furthermore, there is a constant debate regarding the quality of code created with Copilot. To address this question, GitHub conducted a study with 202 developers with at least 5 years of experience. Half of the participants were instructed not to use any AI tools, and the other half were given access to GitHub Copilot. The coding task was to write API endpoints for a web server. Then, the results were reviewed and tested. The main takeaway was the fact that devs using Copilot exemplified a 56% greater likelihood of passing all 10 unit tests. Here are the key findings:
- Devs using Copilot provided more functional code (56% more likely to pass all units).
- Code written using Copilot had fewer readability errors. On average 13.6% more lines of code can be written with no readability issues.
- Those using Copilot provided better quality code in regard to readability, reliability, maintainability, and conciseness.
- Participants with access to Copilot were 5% to have their code approved. This is great for the pace of the whole development process (bug fixes, merging, deployment of features).
GitHub Copilot tries to comprehend what you intend to achieve and create the best code it can. However, the lines it provides may not function or make sense. As GitHub Copilot becomes smarter by the day, all suggestions should still be thoroughly tested, reviewed, and verified, just like any other piece of code, to guarantee security. GitHub states that it works best when the developer breaks code down into discrete functions, and gives function arguments meaningful labels and comments on the go. It also seems to perform best when guiding through new libraries or frameworks.
Is my code safe in GitHub Copilot? What are some of the risks of using GitHub Copilot?
According to research published in August 2021, when Copilot was used to create code in situations relevant to high-risk cybersecurity issues, 40% of the code generated by Copilot was found to be insecure. It is necessary to oversee outcomes as if It was any other code.
AI is trained by public code which is not free from unsafe practices, flaws, and outdated information. When GitHub Copilot generates code suggestions based on this information, it may generate code that has certain non-risk-free patterns. GitHub Copilot should always be used in conjunction with testing and security tools, as well as users’ discretion. To develop the model, GitHub collects telemetry data, which includes information on which suggestions people accept or reject. Private code is not shared with other GitHub Copilot users as suggested code.
The risks regarding the use of GitHub Copilot are real. But that applies to any AI tool. While beneficial for productivity, you need to make sure to have proper security measures in place. This should go without saying but remember to not put any sensitive information into Copilot prompts. The information ranges from API keys and secrets to passwords. The widely adapted rule is to treat it the same way you would treat GitHub itself. Keep in mind that pasting your private code into a prompt could lead to exposure. Don’t overlook this step otherwise, you may end up facing serious consequences like leaks of private code or secrets.
Did you know that code suggestions themselves may also be insecure? It’s important to note that GitHub Copilot is as good as the data it is being trained on… but this data could be outdated or simply not secure. That is why it’s crucial to review any suggestions to stop attackers from exploiting insecure or outdated code by introducing malicious patterns into the training data or even creating poisoned code suggestions.
Another thing to watch out for is Copilot suggesting code that does not exist (package hallucination) or is malicious. This puts the integrity of your project at risk. Then, there is the issue of the lack of attribution along with unclear licensing. The result of overlooking this aspect could have a negative impact on compliance. What you could do is introduce rigorous policies and then closely monitor how Copilot is being used to guarantee better security.
Let’s not forget that safe code delivery and backup are your must-have elements of the secure workflow.
GitHub Copilot unusual use cases
Apart from the possibilities we have already mentioned, GitHub Copilot has other, less common uses. These include:
- If you forget a specific command in VS code, you ask the Copilot how to run it, using the new @terminal agent. It generates a response, and then you can click the “Insert into Terminal” button to run the suggested command.
- Write pull request summaries (Copilot Enterprise feature only). GitHub Copilot is integrated into pull requests. With the help of AI, you can generate a pull request summary of all changes that you made to your files.
- Generate commit messages with GitHub Copilot, right in your IDE. Try to click on the source control button, there you will notice a sparkle in the message input box. Click on those and your commit messages will be generated.
- Use GitHub Copilot in the CLI, to help you by reminding you of commands, teaching you new ones or even explaining random commands you encountered.
- In a scenario where you access a new repository and you are still lost after viewing the README, you can use Copilot to answer your questions regarding the repo. (Copilot Enterprise feature only) Simply click on the Copilot icon in the top right corner and ask away.
- You can fix code inline. Highlight the code you want to fix, then right click it and select “Fix using Copilot.” This way you should be able to see potential fixes suggested by Copilot.
- Use GitHub Copilot to generate documentation for your code.
- If you are struggling to understand an error message in your terminal, you can get help by highlighting it, right clicking, and selecting “Explain with Copilot.” Now you should get a description with a suggested fix.
Will it affect developer jobs?
AI will not replace developers in their jobs for quite some time. For now, AI-assisted programming is a great tool to help humans make their lives easier. Developer productivity could be increased thanks to GitHub Copilot. It could also assist in lowering the cost of software development. This technology will help current engineers be more productive by minimizing manual duties and allowing them to focus on more exciting work. GitHub Copilot has the potential to decrease entry barriers, allowing more people to try their hand at software creation and become part of the future generation of engineers.