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

# who

> Show who knows a file, directory, or repo best

`gx who` identifies the top contributors to your repo, file, or directory. The output format varies depending on whether you pass a file, directory, or nothing.

## Usage

```bash theme={null}
gx who [path] [flags]
```

Examples:

```bash theme={null}
gx who                          # Top contributors (commits)
gx who src/auth.go              # Who owns this file (blame)
gx who src/                     # Who owns this directory
gx who --since 6months          # Only last 6 months
gx who src/ --since 2024-01-01  # Directory, since date
```

## Flags

| Flag         | Short | Default | Description                                                                              |
| ------------ | ----- | ------- | ---------------------------------------------------------------------------------------- |
| `--number`   | `-n`  | 5       | Number of contributors to show                                                           |
| `--since`    |       |         | Only consider contributions after this date (e.g., `6months`, `2024-01-01`, `yesterday`) |
| `--no-limit` |       | false   | Remove file cap for directory analysis                                                   |

## Modes

### Repo-level: `gx who`

When run with no arguments, shows contributors by commit count using `git shortlog -sne HEAD`:

```
$ gx who

 #  Author          Commits  Email
 1  Sarah Chen          953  sarahchen@users.noreply.github.com
 2  James Wilson        138  james.w@example.com
 3  Alex Kim             45  alex.kim@example.com
 4  Maria Lopez          19  maria.l@example.com
 5  Pat Taylor           12  pat.t@example.com
```

### File-level: `gx who <file>`

When given a file path, shows blame-based line ownership:

```
$ gx who src/auth.go

 #  Author          Lines    %  Email                             Last Edit
 1  Sarah Chen        120  54%  sarahchen@users.noreply.github..  2 weeks ago
 2  James Wilson       68  31%  james.w@example.com               1 month ago
 3  Alex Kim           34  15%  alex.kim@example.com              3 months ago
```

### Directory-level: `gx who <dir>`

When given a directory, runs concurrent blame across all files (8 workers, capped at 200 files by default):

```
$ gx who src/

 #  Author          Lines    %  Files  Email                             
 1  Sarah Chen       1420  48%     12  sarahchen@users.noreply.github..
 2  James Wilson      830  28%      8  james.w@example.com
 3  Alex Kim          450  15%      6  alex.kim@example.com
 4  Maria Lopez       180   6%      3  maria.l@example.com
 5  Pat Taylor         90   3%      2  pat.t@example.com
```

Use `--no-limit` to remove the 200-file cap for large directories.

## More Examples

Show the top 10 contributors:

```bash theme={null}
gx who -n 10
```

Analyze a specific directory with no file cap:

```bash theme={null}
gx who src/ --no-limit
```

<Accordion title="How it works under the hood">
  1. **Repo mode** (`gx who`): Runs `git shortlog -sne HEAD` to gather contributors on the current branch
  2. **File mode** (`gx who <file>`): Runs `git blame` and aggregates lines per author, computing percentages and last edit timestamps
  3. **Directory mode** (`gx who <dir>`): Runs `git blame` concurrently across files (8 workers, capped at 200 files unless `--no-limit` is set), then aggregates lines, percentages, and file counts per author
  4. Results are sorted by commit count (repo mode) or line count (file/directory mode) descending
</Accordion>
