Skip to content

Git & Version Control Tools

Tools for version control inspection, repository status, commit history, and patch application.


1. git_diff

Inspect unified git diff of working tree changes or staged commits.

  • Signature: git_diff(path: str = "", cached: bool = False) -> str
  • Parameters:
  • path: Optional relative path or directory within the git repository.
  • cached: When True, displays staged (--cached) differences; when False, displays unstaged changes.
  • Returns: Unified diff string or (No git diff changes detected).

2. git_status

Inspect short git status of modified, staged, and untracked files in the working directory.

  • Signature: git_status() -> str
  • Returns: Formatted short git status (--short) or confirmation that the working tree is clean.

3. git_log

Inspect recent git commit history in compact format.

  • Signature: git_log(max_count: int = 5) -> str
  • Parameters:
  • max_count: Number of recent commits to display (default 5, capped at 20).
  • Returns: One-line decorated commit history log.

4. apply_patch

Apply a unified diff patch directly to the repository.

  • Signature: apply_patch(patch: str) -> str
  • Parameters:
  • patch: Unified diff patch string (standard format as generated by git diff).
  • Returns: Success confirmation message or detailed patch failure error output.