simple-git Reference

Inspect Git repository status, logs, diffs, and checkouts via simple-git.

11|2|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/recca0120/code-quest --skill simple-git-reference
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: simple-git Reference
Source: https://github.com/recca0120/code-quest/tree/main/.claude/skills/simple-git-reference
Command: npx skills add https://github.com/recca0120/code-quest --skill simple-git-reference

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you reliably perform common Git operations from TypeScript using the simple-git library, including status, logs, diffs, checkout, and raw Git commands, without juggling ad-hoc shell parsing.

Core Features & Use Cases

  • Per-repo simpleGit instance setup: Create a lightweight instance per repository working directory to avoid singleton state issues and keep a predictable task queue.
  • Core Git workflows: Use status to check cleanliness and file change codes, log to summarize history, and diff to get unstaged or staged changes.
  • Branch and plumbing commands: Perform checkouts with fetch+fallback behavior, resolve repo root paths, and run advanced operations via raw for any commands not wrapped by simple-git.
  • Error handling patterns: Catch GitError and understand when GitResponseError indicates parsed-response problems (even if Git exit code is success).

Quick Start

Use the simple-git Reference to create an instance for your repository and call status to get the current branch name, clean/dirty state, and the list of changed files with their status codes.

Frequently Asked Questions about simple-git Reference

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check git status and changed files programmatically in TypeScript?

To get staged and unstaged git diffs in TypeScript, use the diff method on a SimpleGit instance. It provides structured output of changes without needing to parse shell output manually, supporting both staged and unstaged file modifications.

Why does simple-git throw a GitResponseError when the git exit code is success?

A GitResponseError occurs when simple-git successfully executes a command but encounters issues parsing the response. You must handle GitError for execution failures and GitResponseError separately to manage parsed-response problems even when the git exit code is success.

Can I run git commands not wrapped by simple-git in TypeScript?

Yes, you can run unsupported git commands by using the raw method on a SimpleGit instance. This allows you to execute advanced plumbing commands directly while still benefiting from the library's task queue and error handling patterns.

What is the best way to avoid singleton state issues when monitoring multiple git repositories?

The best way to avoid singleton state issues is to construct a lightweight SimpleGit instance per repository working directory. This ensures isolated state and keeps a predictable task queue for each local git repository you inspect.