Skip to content

Git file history

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

Git file history provides information about the commit history associated with a file:

A list of 3 commits for a single file, with the newest commit marked as 'Verified'.

Each commit shows:

  • The date of the commit. GitLab groups together all commits made on the same day.
  • The user's avatar.
  • The user's name. Hover over the name to see the user's job title, location, local time, and current status message.
  • The date of the commit, in time-ago format. To see the precise date and time of the commit, hover over the date.
  • If the commit is signed, a Verified badge.
  • The commit SHA. GitLab shows the first 8 characters. Select Copy commit SHA ({copy-to-clipboard}) to copy the entire SHA.
  • A link to browse ({folder-open}) the file as it appeared at the time of this commit.

GitLab retrieves the user name and email information from the Git configuration of the contributor when the user creates a commit.

View a file's Git history

To see a file's Git history in the UI:

  1. On the left sidebar, select Search or go to and find your project.
  2. Select Code > Repository.
  3. Go to your desired file in the repository.
  4. In the upper-right corner, select History.

Related topics

Troubleshooting

Limit history range of results

When reviewing history for old files, or files with many commits, you can limit the search results by date. Limiting the dates for commits helps fix commit history requests timeouts in very large repositories.

In the GitLab UI, edit the URL. Include these parameters in YYYY-MM-DD format:

  • committed_before
  • committed_after

Separate each key-value pair in the query string with an ampersand (&), like this:

?ref_type=heads&committed_after=2023-05-15&committed_before=2023-11-22

The full URL to the range of commits looks like this:

For example:

https://gitlab.com/gitlab-org/gitlab/-/commits/master/CONTRIBUTING.md?ref_type=heads&committed_after=2023-05-15&committed_before=2023-11-22