---
name: "hg-annotate"
section: "1"
platform: "linux"
package: "mercurial"
version: "7.2.4-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/hg-annotate"
---

# hg-annotate(1)

show changeset information by line for each file

## NAME

hg annotate - show changeset information by line for each file

## SYNOPSIS

```
hg annotate [-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...
```

## DESCRIPTION

List changes in files, showing the revision id responsible for each line.

This command is useful for discovering when a change was made and by whom.

If you include --file, --user, or --date, the revision number is suppressed unless you also include --number.

Without the -a/--text option, annotate will avoid processing files it detects as binary. With -a, annotate will annotate the file anyway, although the results will probably be neither useful nor desirable.

Use -L/--line-range FILE,M:N options to filter the output to the lines from M to N in FILE. This option is incompatible with --no-follow and cannot be combined with file pattern arguments. When combined with --rev the line ranges refer to the state of the file at the requested revision.

Template:

The following keywords are supported in addition to the common template keywords and functions. See also **hg help templates**.

- **lines**

  List of lines with annotation data.

- **path**

  String. Repository-absolute path of the specified file.

  And each entry of **{lines}** provides the following sub-keywords in addition to **{date}**, **{node}**, **{rev}**, **{user}**, etc.

- **line**

  String. Line content.

- **lineno**

  Integer. Line number at that revision.

- **path**

  String. Repository-absolute path of the file at that revision.

  See **hg help templates.operators** for the list expansion syntax.

  Returns 0 on success.

## OPTIONS

- **-r,***--rev* **\<REV\>**

  annotate the specified revision

- **--follow**

  follow copies/renames and list the filename (DEPRECATED)

- **--no-follow**

  don't follow copies and renames

- **-a, --text**

  treat all files as text

- **-u, --user**

  list the author (long with -v)

- **-f, --file**

  list the filename

- **-d, --date**

  list the date (short with -q)

- **-n, --number**

  list the revision number (default)

- **-c, --changeset**

  list the changeset

- **-l, --line-number**

  show line number at the first appearance

- **--skip** *\<REV\[+\]\>*

  revset to not display (EXPERIMENTAL)

- **-L,***--line-range* **\<FILE,RANGE\[+\]\>**

  follow line range of specified file (EXPERIMENTAL)

- **-w, --ignore-all-space**

  ignore white space when comparing lines

- **-b, --ignore-space-change**

  ignore changes in the amount of white space

- **-B, --ignore-blank-lines**

  ignore changes whose lines are all blank

- **-Z, --ignore-space-at-eol**

  ignore changes in whitespace at EOL

- **-I,***--include* **\<PATTERN\[+\]\>**

  include names matching the given patterns

- **-X,***--exclude* **\<PATTERN\[+\]\>**

  exclude names matching the given patterns

- **-T,***--template* **\<TEMPLATE\>**

  display with template

  \[+\] marked option can be specified multiple times

## ALIASES

```
blame
```
