Explain code in a file

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

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