Skip to content

GitHub Copilot Updated to Notify Developers of Matching Code in Public Repositories

GitHub Copilot introduces code referencing, letting developers view suggestions that match public repository code, enhancing licensing flexibility and choice.

GitHub Copilot Unveils Code Referencing Feature

GitHub Copilot, which revolutionized the way developers write code, has introduced a new feature to address issues related to code similarity with public repositories. The new code referencing feature, launched in private beta today, offers developers more control and choices regarding matching code suggestions.

Previously, in 2022, GitHub launched a feature to block suggestions that matched public code automatically, which would trigger less than 1% of the time. While effective, this was considered a blunt tool as it limited developers' ability to explore or make informed decisions regarding open-source libraries or other available options.

To find a more nuanced solution, GitHub's code referencing feature provides developers with the opportunity to view matching code instead of blocking it automatically. With code referencing enabled, Copilot displays the matching code in a sidebar, letting developers decide how to proceed. This feature is set to extend to Copilot Chat in the future.

GitHub CEO Thomas Dohmke explained the original blocking feature's limitations, saying, “It gives you little control to decide for yourself whether you actually want to take that code and attribute it back to an open source license. It doesn’t actually let you discover that there might be a library that you could use instead of synthesizing code."

The new feature is especially applicable to common algorithms that are found in many places. Developers can reject the code, use it directly (if the library allows), or have Copilot rewrite the code to avoid matching the original.

While the current version doesn't allow results to match specific licenses, GitHub is actively seeking feedback to understand user needs. The code referencing feature is more likely to activate when there's less context for Copilot, meaning it's more prevalent during the early stages of coding.

This new feature leverages a fast search engine to find matching code and its license quickly. Although currently listing matching snippets in the order found, the company may add sorting options based on repository license or commit date later.

This introduction of code referencing in GitHub Copilot is seen as a significant step towards filling the gaps that existed with the original solution. It enables developers to understand the match, explore alternatives, and make informed decisions, enhancing their flexibility and choice in coding practices.

Latest