diff options
Diffstat (limited to 'doc/user/project/repository/git_blame.md')
-rw-r--r-- | doc/user/project/repository/git_blame.md | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/doc/user/project/repository/git_blame.md b/doc/user/project/repository/git_blame.md index 3f49f1e05f2..a602638d244 100644 --- a/doc/user/project/repository/git_blame.md +++ b/doc/user/project/repository/git_blame.md @@ -1,8 +1,7 @@ --- stage: Create group: Source Code -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments -type: reference, howto +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 description: "Documentation on Git file blame." --- @@ -21,48 +20,59 @@ Prerequisites: To view the blame for a file: -1. Go to your project's **Code > Repository**. +1. On the left sidebar, select **Search or go to** and find your project. +1. Select **Code > Repository**. 1. Select the file you want to review. -1. In the upper-right corner, select **Blame**. +1. In the upper-right corner, select **Blame**, and go to the line you want to see. When you select **Blame**, this information is displayed: -![Git blame output](img/file_blame_output_v12_6.png "Blame button output") +![Git blame output](img/file_blame_output_v16_6.png "Blame button output") -If you hover over a commit in the UI, the commit's precise date and time -are shown. +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 +### Blame previous commit -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/19299) in GitLab 12.7. +To see earlier revisions of a specific line: -To see earlier revisions of a specific line, select **View blame prior to this change** -until you've found the changes you're interested in viewing: - -![Blame previous commit](img/file_blame_previous_commit_v12_7.png "Blame previous commit") +1. On the left sidebar, select **Search or go to** and find your project. +1. Select **Code > Repository**. +1. Select the file you want to review. +1. In the upper-right corner, select **Blame**, and go to the line you want to see. +1. Select **View blame prior to this change** (**{doc-versions}**) + until you've found the changes you're interested in viewing. ## Associated `git` command If you're running `git` from the command line, the equivalent command is `git blame <filename>`. For example, if you want to find `blame` information -about a `README.md` file in the local directory, run the following command: +about a `README.md` file in the local directory: -```shell -git blame README.md -``` +1. Run this command `git blame README.md`. +1. If the line you want to see is not in the first page of results, press <kbd>Space</kbd> + until you find the line you want. +1. To exit out of the results, press <kbd>Q</kbd>. -The output looks similar to the following, which includes the commit time -in UTC format: +The `git blame` output in the CLI looks like this: ```shell -62e2353a (Achilleas Pipinellis 2019-07-11 14:52:18 +0300 1) [![build status](https://gitlab.com/gitlab-org/gitlab-docs/badges/master/build.svg)](https://gitlab.com/gitlab-com/gitlab-docs/commits/master) -fb0fc7d6 (Achilleas Pipinellis 2016-11-07 22:21:22 +0100 2) -^764ca75 (Connor Shea 2016-10-05 23:40:24 -0600 3) # GitLab Documentation -^764ca75 (Connor Shea 2016-10-05 23:40:24 -0600 4) -0e62ed6d (Mike Jang 2019-11-26 21:44:53 +0000 5) This project hosts the repository used to generate the GitLab -0e62ed6d (Mike Jang 2019-11-26 21:44:53 +0000 6) documentation website and deployed to https://docs.gitlab.com. It uses the +58233c4f1054c (Dan Rhodes 2022-05-13 07:02:20 +0000 1) ## Contributor License Agreement +b87768f435185 (Jamie Hurewitz 2017-10-31 18:09:23 +0000 2) +8e4c7f26317ff (Brett Walker 2023-10-20 17:53:25 +0000 3) Contributions to this repository are subject to the +58233c4f1054c (Dan Rhodes 2022-05-13 07:02:20 +0000 4) ``` -## File blame through the API +The output includes: + +- The SHA of the commit. +- The name of the committer. +- The date and time in UTC format. +- The line number. +- The contents of the line. + +## Related topics -You can also get this information over the [Git file blame REST API](../../../api/repository_files.md#get-file-blame-from-repository). +- [Git file blame REST API](../../../api/repository_files.md#get-file-blame-from-repository). |