Skip to main content

Syntax

gitnexus clean

Description

Removes the .gitnexus/ index from the current repository and unregisters it from the global registry. By default, the command prompts for confirmation before deleting. Use --force to skip the prompt.

Options

--force
boolean
Skip confirmation prompt and delete immediately.
--all
boolean
Clean all indexed repositories instead of just the current one.Requires --force for confirmation.

Usage Examples

Clean current repository (with prompt)

gitnexus clean
Output:
This will delete the GitNexus index for: my-app
   Path: /Users/dev/projects/my-app/.gitnexus

Run with --force to confirm deletion.

Clean current repository (skip prompt)

gitnexus clean --force
Output:
Deleted: /Users/dev/projects/my-app/.gitnexus

Clean all repositories (with prompt)

gitnexus clean --all
Output:
This will delete GitNexus indexes for 2 repo(s):
  - my-app (/Users/dev/projects/my-app/.gitnexus)
  - backend-api (/Users/dev/projects/backend-api/.gitnexus)

Run with --force to confirm deletion.

Clean all repositories (skip prompt)

gitnexus clean --all --force
Output:
Deleted: my-app (/Users/dev/projects/my-app/.gitnexus)
Deleted: backend-api (/Users/dev/projects/backend-api/.gitnexus)

What Gets Deleted

  • .gitnexus/ directory in the repository
    • KuzuDB database files
    • Full-text search indexes
    • Embedding data
    • Wiki output
    • Metadata files
  • Entry in global registry (~/.gitnexus/registry.json)

What Doesn’t Get Deleted

  • Source code (only the index is removed)
  • AI context files (AGENTS.md, CLAUDE.md) — these are kept
  • Global skills in ~/.claude/skills/ or ~/.cursor/skills/
  • MCP configuration files

Safety

The clean command is safe — it only deletes GitNexus’s own data. Your source code and git history are never touched. The .gitnexus/ directory is automatically gitignored by the analyze command, so indexes are never committed to version control.

When to Use

Free up disk space

Indexes can be large for big repositories (100MB+ for large codebases). Clean unused indexes:
gitnexus clean --force

Reset corrupted index

If the index is corrupted or incomplete:
gitnexus clean --force
gitnexus analyze

Before archiving a repository

gitnexus clean --force
tar -czf my-app.tar.gz my-app/

Clean all old indexes

Remove all indexes at once:
gitnexus clean --all --force

After Cleaning

To re-index a repository:
gitnexus analyze
The MCP server and HTTP server will automatically discover the new index (no restart needed).

Build docs developers (and LLMs) love