---
title: "af file"
description: "List, show and annotate files at a commit"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.forge.workreef.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# af file

<!-- Generated by tools/gen-reference.mjs from `af file --help`. Change the help text in crates/atoll-forge-cli/src/main.rs, then run `npm run gen:reference`. -->

## Usage

```text
af file [OPTIONS] <COMMAND>
```

## Commands

| Command | What it does |
| --- | --- |
| [`list`](#af-file-list) | List the files in a commit |
| [`annotate`](#af-file-annotate) | Show the change that added each line of a file |
| [`show`](#af-file-show) | Print a file's contents at a commit |
| [`untrack`](#af-file-untrack) | Stop tracking files that are ignored |

## Global options

Every `af` command also takes the [global options](https://docs.forge.workreef.dev/reference/af/#global-options).

## Examples

```sh
af file list
af file show src/main.rs
af file show -r 'main-' settings.ini
af file untrack build
```

## af file list {#af-file-list}

List the files in a commit

### Usage

```text
af file list [OPTIONS] [PATHS]...
```

### Arguments

- `[PATHS]...`

  Glob patterns, from the repository root, limiting the files listed

  For example, `docs/**` matches everything under `docs`, while `docs` matches only a file named `docs`.

### Options

- `-r, --revision <REVISION>`

  Revset selecting the commit; defaults to the workspace's change

### Global options

Every `af` command also takes the [global options](https://docs.forge.workreef.dev/reference/af/#global-options).

## af file annotate {#af-file-annotate}

Show the change that added each line of a file

Prints each line of PATH with the change that added it, and that change's author and time. Lines are printed exactly as the file stores them.

### Usage

```text
af file annotate [OPTIONS] <PATH>
```

### Arguments

- `<PATH>`

  File to annotate, relative to the current directory

### Options

- `-r, --revision <REVISION>`

  Revset selecting the commit; defaults to the workspace's change

### Global options

Every `af` command also takes the [global options](https://docs.forge.workreef.dev/reference/af/#global-options).

## af file show {#af-file-show}

Print a file's contents at a commit

### Usage

```text
af file show [OPTIONS] <PATH>
```

### Arguments

- `<PATH>`

  File to print, relative to the current directory

### Options

- `-r, --revision <REVISION>`

  Revset selecting the commit to read from; defaults to main's latest landing

### Global options

Every `af` command also takes the [global options](https://docs.forge.workreef.dev/reference/af/#global-options).

## af file untrack {#af-file-untrack}

Stop tracking files that are ignored

Takes the files at or under each PATH out of the workspace's change and stops tracking them, leaving them on disk, as `jj file untrack` does. Each must be ignored by a `.gitignore`, or the next snapshot would take it back: if one isn't, nothing is untracked.

### Usage

```text
af file untrack [OPTIONS] <PATHS>...
```

### Arguments

- `<PATHS>...`

  Files or directories, relative to the current directory

### Global options

Every `af` command also takes the [global options](https://docs.forge.workreef.dev/reference/af/#global-options).

Source: https://docs.forge.workreef.dev/reference/af/file/index.mdx
