# Git: View the Full Change History of a Single File

> Run git log --follow --patch on a filename to see its full diff history across renames, or use gitk for a visual browser of the same file history

**URL:** https://sentry.io/answers/view-the-change-history-of-a-single-file-in-git/

---

## The Problem

How can I see the change history of a single file in my Git repository?

## The Solution

We can show the full change history of a file, taking renames into account, using the [`git log`](https://git-scm.com/docs/git-log) command:

```bash
git log --follow --patch -- name-of-file
```

The [`--patch/-p` flag](https://git-scm.com/docs/git-log#Documentation/git-log.txt--p) generates patch text, i.e. diffs of the file across commits. The [`--follow` flag](https://git-scm.com/docs/git-log#Documentation/git-log.txt---follow) will include changes across renames in our change log. Note that `--follow` will only work if we're looking at a single file – we should remove this flag if we're viewing the history of multiple files, or want to exclude history past the file's most recent renaming.

The above `git log` command will output our file's history as a series of diffs. Alternatively, we can view this information in `gitk`, Git's built-in repository visualizer, by entering this command:

```bash
gitk name-of-file
```

---

*Source: [sentry.io/answers/view-the-change-history-of-a-single-file-in-git/](https://sentry.io/answers/view-the-change-history-of-a-single-file-in-git/)*
