Skip to content

Git file history

DETAILS: Tier: Free, Premium, Ultimate Offering: SaaS, self-managed

Git file History provides information about the commit history associated with a file. To use it:

  1. Go to your project's Code > Repository.
  2. In the upper-right corner, select History.

When you select History, this information is displayed:

Git log output

If you hover over a commit in the UI, the precise date and time of the commit modification are shown.

The name and email information provided are retrieved from the Git configuration of the contributor when a commit is made.

Limit history range

In these cases you can constrain the search period by adding committed_before and committed_after dates as parameters. To do this, add & and committed_before=YYYY-MM-DD or committed_after=YYYY-MM-DD parameters to the URL.

For example:

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

Doing this might be necessary to fix commit history requests timeouts in very large repositories.

Associated git command

If you're running git from the command line, the equivalent command is git log <filename>. For example, if you want to find history information about a README.md file in the local directory, run the following command:

git log README.md

Git displays output similar to the following, which includes the commit time in UTC format:

commit 0e62ed6d9f39fa9bedf7efc6edd628b137fa781a
Author: Mike Jang <mjang@gitlab.com>
Date:   Tue Nov 26 21:44:53 2019 +0000

    Deemphasize GDK as a doc build tool

commit 418879420b1e3a4662067bd07b64bb6988654697
Author: Marcin Sedlak-Jakubowski <msedlakjakubowski@gitlab.com>
Date:   Mon Nov 4 19:58:27 2019 +0100

    Fix typo

commit 21cc1fef11349417ed515557748369cfb235fc81
Author: Jacques Erasmus <jerasmus@gitlab.com>
Date:   Mon Oct 14 22:13:40 2019 +0000

    Add support for modern JS

    Added rollup to the project

commit 2f5e895aebfa5678e51db303b97de56c51e3cebe
Author: Achilleas Pipinellis <axil@gitlab.com>
Date:   Fri Sep 13 14:03:01 2019 +0000

    Remove gitlab-foss Git URLs as we don't need them anymore

    [ci skip]