Explain code in a file
DETAILS: Tier: GitLab.com and Self-managed: For a limited time, Premium or Ultimate. On October 17, 2024, Premium with GitLab Duo Pro or Ultimate with GitLab Duo Pro or Enterprise. GitLab Dedicated: GitLab Duo Pro or Enterprise. Offering: GitLab.com, Self-managed, GitLab Dedicated
- Introduced in GitLab 15.11 as an experiment on GitLab.com.
- Generally available in GitLab 16.8.
If you spend a lot of time trying to understand code that others have created, or you struggle to understand code written in a language you are not familiar with, you can ask GitLab Duo to explain the code to you.
Prerequisites:
- You must belong to at least one group with the experiment and beta features setting enabled.
- You must have access to view the project.
To explain the code in a file:
-
On the left sidebar, select Search or go to and find your project.
-
Select a file that contains code.
-
Select the lines you want explained.
-
On the left side, select the question mark ({question}). You might have to scroll to the first line of your selection to view it.
Duo Chat explains the code. It might take a moment for the explanation to be generated.
If you'd like, you can provide feedback about the quality of the explanation.
We cannot guarantee that the large language model produces results that are correct. Use the explanation with caution.
You can also explain code in:
- A merge request.
- The IDE.