## Viewing line-by-line authorship

`git blame` annotates each line of a file with the commit hash, author name, timestamp, and line number of the last change to that line.

```
$ git blame <file>
```

Output is printed one line at a time. Each line shows the abbreviated commit hash, the author, the date, the line number, and the line content. To see the full commit details for a specific hash, use [`git log`](/git/viewing-previous-commits) or [`git show`](/git/viewing-previous-commits).

## Limiting output to a line range

Use `-L` with a start and end line number to restrict output — useful for large files where you only care about a particular function.

```
$ git blame -L 10,25 <file>
```

To show a number of lines from a starting point:

```
$ git blame -L 10,+15 <file>
```

## Formatting the output

### Use abbreviated commit hashes

```
$ git blame --abbrev=7 <file>
```

### Ignore whitespace-only changes

The `-w` flag tells Git to ignore commits that only changed whitespace, preventing reformatting commits from obscuring the real author.

```
$ git blame -w <file>
```

## Machine-readable output

The `--porcelain` flag outputs blame in a stable, parseable format intended for scripts and editor integrations.

```
$ git blame --porcelain <file>
```

Most IDE Git integrations (VS Code, JetBrains, Vim plugins) use this format internally when displaying inline blame annotations.

Once you have identified a commit of interest, use [`git diff`](/git/commands/git-diff) to see exactly what changed in that commit.

Once your code is ready, [DeployHQ](https://www.deployhq.com) can deploy it to your servers automatically from any Git repository.