> ## Documentation Index
> Fetch the complete documentation index at: https://codegeninc-codegen-bot-sdk-docs-2-0.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Reset Command

The `reset` command performs a hard reset of your git repository while carefully preserving all files in the `.codegen` directory. This is useful for undoing codemod changes while keeping your codemod implementations intact.

## Usage

```bash
codegen reset
```

## What it Does

When you run `codegen reset`, it:

1. Backs up all files in `.codegen` directory, preserving their content and staged/unstaged status
2. Performs a hard reset (`git reset --hard HEAD`) on the repository
3. Restores all `.codegen` files to their previous state, including their git staging status
4. Removes untracked files (except those in `.codegen`)

<Note>
  This is more sophisticated than `git checkout .` as it:

  * Preserves both staged and unstaged changes in `.codegen`
  * Handles deleted files correctly
  * Removes untracked files (like `git clean`) while protecting `.codegen`
</Note>

## Examples

Reset after testing a codemod:

```bash
# Run your codemod
codegen run organize-imports

# If the changes aren't what you wanted
codegen reset  # Reverts changes but keeps your codemod implementation
```

<Warning>
  This command performs a hard reset and removes untracked files. Make sure you have committed any changes you want to keep outside of `.codegen`.
</Warning>
