Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 CLI Documentation | 2026.1

# Displaying annotations (details about changes to file contents)

To find out which file revisions or changelists affected lines in a text file, issue the `p4 annotate` command.

By default, `p4 annotate` displays the file line by line, with each line preceded by a revision number indicating the revision that made the change. To display changelist numbers instead of revision numbers, specify the `-c` option.

Example: Using p4 annotate to display changes to a file

A file is added (`file.txt#1`) to the depot, containing the following lines:

    This is a text file.
    The second line has not been changed.
    The third line has not been changed.

The third line is deleted and the second line edited so that `file.txt#2` reads:

    This is a text file.
    The second line is new.

The output of `p4 annotate` and `p4 annotate -c` look like this:

    p4 annotate file.txt
    //Acme/files/file.txt#3 - edit change 153 (text)
    1: This is a text file.
    2: The second line is new.

    p4 annotate -c file.txt
    //Acme/files/file.txt#3 - edit change 153 (text)
    151: This is a text file.
    152: The second line is new.

The first line of `file.txt` has been present since revision 1, which was submitted in changelist 151. The second line has been present since revision 2, which was submitted in changelist 152.

To show all lines (including deleted lines) in the file, use `p4 annotate -a` as follows:

    p4 annotate -a file.txt
    //Acme/files/file.txt#3 - edit change 12345 (text)
    1-3: This is a text file.
    1-1: The second line has not been changed.
    1-1: The third line has not been changed.
    2-3: The second line is new.

The first line of output shows that the first line of the file has been present for revisions 1 through 3. The next two lines of output show lines of `file.txt` present only in revision 1. The last line of output shows that the line added in revision 2 is still present in revision 3.

You can combine the `-a` and `-c` options to display all lines in the file and the changelist numbers (rather than the revision numbers) at which the lines existed.

Your search for returned results