Skip to content
代码片段 群组 项目
代码所有者
将用户和群组指定为特定文件更改的核准人。 了解更多。
code_explain.md 2.23 KiB
stage: Create
group: Code Creation
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
title: 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, GitLab Self-Managed, GitLab Dedicated
  • LLM: Anthropic Claude 3.7 Sonnet

{{< /details >}}

{{< history >}}

  • 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.

{{< /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 ({{< icon name="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: