git_reset
Reset a Git repository to a target commit (default HEAD) in soft, mixed, or hard mode to undo commits, unstage changes, or discard working tree changes. Preview impact before confirming.
Instructions
Reset the repository to a target commit (default HEAD) in soft, mixed, or hard mode. Use this to undo commits, unstage changes, or discard working tree changes. DESTRUCTIVE: requires confirmed=True to execute; run preview=True first to see which tracked changes would be discarded (hard/mixed modes), while soft mode only moves HEAD and touches neither the working tree nor the index. Does NOT create a new commit — use git_revert to undo a published commit safely, or git_stash to keep changes before resetting. Best for: undoing commits or unstaging changes. Returns: 'Reset () to .' on success, or an impact preview when preview=True.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | One of: soft, mixed, hard | mixed |
| target | No | Commit to reset to, defaults to HEAD | |
| preview | No | Preview the reset impact (files that would be discarded) without executing | |
| confirmed | No | Explicit confirmation for the destructive reset | |
| repo_path | No | Path to the git repository, defaults to '.' (the server working directory) | . |