rollback_to_commit
Reset a Git repository to a previous commit using soft, mixed, or hard modes to undo changes while controlling what happens to staged and working directory files.
Instructions
Roll back the repository state to a previous commit.
This tool resets the current branch head to commit_sha. The mode determines
what happens to the working directory and index:
"soft" (Default): Undoes the commit(s) but leaves changes staged in the index. Useful if you want to squash commits or fix the last commit message.
"mixed": Undoes the commit(s) and unstages changes, but keeps the files in the working directory. Useful if you want to keep the work but start fresh with staging.
"hard": WARNING - Destructive! Resets everything to the state of
commit_sha. Any uncommitted changes (staged or unstaged) will be PERMANENTLY LOST. Use this only if you want to discard all work sincecommit_sha.
Args: repo_path: The absolute path to the repository. commit_sha: The full or short SHA of the commit to revert to. mode: The reset mode: "soft", "mixed", or "hard".
Returns: A message confirming the rollback and the new HEAD SHA.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo_path | Yes | ||
| commit_sha | Yes | ||
| mode | No | soft |