Skip to content

Explain code in a file

DETAILS: Tier: Premium with GitLab Duo Pro, Ultimate with GitLab Duo Pro or Enterprise - Start a trial Offering: GitLab.com, Self-managed, GitLab Dedicated

  • Introduced in GitLab 15.11 as an experiment on GitLab.com.
  • Generally available in GitLab 16.8.
  • Changed to require GitLab Duo add-on in GitLab 17.6 and later.

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:

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 ({question}). 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: