Git file blame

Tier: Free, Premium, Ultimate Offering: GitLab.com, Self-managed, GitLab Dedicated

Git blame provides more information about every line in a file, including the last modified time, author, and commit hash.

View blame for a file

History
  • Viewing blame directly in the file view introduced in GitLab 16.7 with flag named inline_blame. Disabled by default.

Prerequisites:

  • The file type must be text-based. The GitLab UI does not display git blame results for binary files.

To view the blame for a file:

  1. On the left sidebar, select Search or go to and find your project.
  2. Select Code > Repository.
  3. Select the file you want to review.
  4. Either:
    • To change the view of the current file, in the file header, select Blame.
    • To open the full blame page, in the upper-right corner, select Blame.
  5. Go to the line you want to see.

When you select Blame, this information is displayed:

Git blame output

To see the precise date and time of the commit, hover over the date. The vertical bar to the left of the user avatar shows the general age of the commit. The newest commits have a dark blue bar. As the age of the commit increases, the bar color changes to light gray.

Blame previous commit

To see earlier revisions of a specific line:

  1. On the left sidebar, select Search or go to and find your project.
  2. Select Code > Repository.
  3. Select the file you want to review.
  4. In the upper-right corner, select Blame, and go to the line you want to see.
  5. Select View blame prior to this change () until you’ve found the changes you’re interested in viewing.