Preview: referencing public code in GitHub Copilot
We will begin to introduce several new capabilities to GitHub Copilot in 2023 to continue delivering responsible innovation and true happiness at the keyboard.

Back in June, we introduced a feature that allows developers to block suggestions of 150+ characters matching public code (ignoring whitespace). While useful in some contexts, blocking matching suggestions doesn’t address all use cases.
It’s within this context that we will begin to introduce several new capabilities in 2023. For any code fragment suggested by Copilot, developers should have:
- An inventory of similar code found in GitHub public repositories
- The ability to sort that inventory by repository license, commit date, etc.
Let’s take a simple, real world example to see how it might work. JavaScript developers may immediately recognize this:
const root = ReactDOM.createRoot(document.getElementById('root'))
This code fragment appears verbatim in thousands of JS files not because it’s the only way to formulate the expression, but because it’s the conventional implementation. As you might expect, it also appears in repositories with many different licenses. If it weren’t already a rather popular and well-documented piece of code, you may not know it originally appeared in the React repo. In Copilot’s next major release, we’ll provide the ability to identify strings matching public code with a reference to those repositories.
Using this information, a developer might find inspiration from other codebases, discover documentation, and almost certainly gain confidence that this fragment is appropriate to use in their project. They might take a dependency, provide attribution where appropriate, or possibly even pursue another implementation strategy.By helping developers understand thecommunity context of their code in a manner that also preserves developer flow, we believe Copilot will continue to deliver responsible innovation and true happiness at the keyboard.
Tags:
More onGitHub Copilot
From chaos to clarity: Using GitHub Copilot agents to improve developer workflows
Explore how you can set Copilot coding agent up for success with custom instruction and Copilot setup steps.
Code review in the age of AI: Why developers will always own the merge button
When it comes to merging code, developers will always make the final decision. But we’re rethinking how tools like GitHub Copilot can help.
Related posts

For the Love of Code: a summer hackathon for joyful, ridiculous, and wildly creative projects
That idea you’ve been sitting on? The domain you bought at 2AM? A silly or serious side project? This summer, we invite you to build it — for the joy, for the vibes, For the Love of Code 🧡

From chaos to clarity: Using GitHub Copilot agents to improve developer workflows
Explore how you can set Copilot coding agent up for success with custom instruction and Copilot setup steps.

Code review in the age of AI: Why developers will always own the merge button
When it comes to merging code, developers will always make the final decision. But we’re rethinking how tools like GitHub Copilot can help.
Explore more from GitHub
GitHub
Build what’s next on GitHub, the place for anyone from anywhere to build anything.
GitHub Universe 2025
Last chance: Save $700 on your IRL pass to Universe and join us on Oct. 28-29 in San Francisco.
We do newsletters, too
Discover tips, technical guides, and best practices in our biweekly newsletter just for devs.