Skip to main content
Glama
archish9

GitHub MCP Server

by archish9

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 since commit_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

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes
commit_shaYes
modeNosoft

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/archish9/github-mcp-small'

If you have feedback or need assistance with the MCP directory API, please join our Discord server