Git Reset
git_resetReset repository HEAD to undo commits, unstage files, or discard changes. Use soft, mixed, or hard modes to control whether modifications are preserved, unstaged, or removed.
Instructions
Reset current HEAD to specified state. Can be used to unstage files (soft), discard commits (mixed), or discard all changes (hard).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Path to the Git repository. Defaults to session working directory set via git_set_working_dir. | . |
| mode | No | Reset mode: soft (keep changes staged), mixed (unstage changes), hard (discard all changes), merge (reset and merge), keep (reset but keep local changes). | mixed |
| target | No | Target commit to reset to (default: HEAD). | |
| paths | No | Specific file paths to reset (leaves HEAD unchanged). | |
| confirmed | No | Explicit confirmation required for hard, merge, and keep reset modes on protected branches (main, master, production, etc.). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | Yes | Indicates if the operation was successful. | |
| mode | Yes | Reset mode that was used. | |
| target | Yes | Target commit that was reset to. | |
| filesReset | Yes | Files that were affected by the reset. |