Explain code in a file
- Tier: Premium with GitLab Duo Pro, Ultimate with GitLab Duo Pro or Enterprise - Start a trial
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
- LLM: Anthropic Claude 3.5 Sonnet
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 ( ). 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.
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support