Explain code in a file

Tier: For a limited time, Premium and Ultimate. In the future, GitLab Duo Pro or Enterprise. Offering: GitLab.com Status: Experiment
  • Introduced in GitLab 15.11 as an experiment on GitLab.com.

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.


To explain the code in a file:

  1. On the left sidebar, select Search or go to and find your project.
  2. Select a file that contains code.
  3. Select the lines you want explained.
  4. On the left side, select the question mark (). You might have to scroll to the first line of your selection to view it.

    explain code in a file

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: