@selfagency/git-mcp 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selfagency/git-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "A Git MCP server that doesn't suck",
5
5
  "keywords": [
6
6
  "git",
@@ -26,7 +26,8 @@
26
26
  "files": [
27
27
  "./index.js",
28
28
  "./index.js.map",
29
- "./index.d.ts"
29
+ "./index.d.ts",
30
+ "./skills"
30
31
  ],
31
32
  "bin": {
32
33
  "git-mcp": "./index.js"
@@ -38,8 +39,8 @@
38
39
  }
39
40
  },
40
41
  "dependencies": {
41
- "@modelcontextprotocol/sdk": "^1.28.0",
42
- "simple-git": "^3.33.0",
42
+ "@modelcontextprotocol/sdk": "^1.29.0",
43
+ "simple-git": "^3.36.0",
43
44
  "zod": "^4.3.6"
44
45
  }
45
46
  }
@@ -0,0 +1,218 @@
1
+ ---
2
+ name: git-mcp-workflow
3
+ description: 'Use for repositories managed through the git-mcp server when an agent needs to inspect repository state, create commits, manage branches and remotes, rebase, cherry-pick, stash, bisect, work with worktrees, handle Git Flow or git-flow-next-style workflows, manage tags, recover from mistakes, or explain Git concepts using MCP tools instead of raw git CLI commands. Especially relevant for prompts about git_status, git_commit, git_push, git_rebase, git_cherry_pick, git_worktree, git_stash, git_reflog, git_flow, git_lfs, submodules, PR preparation, release tagging, and Git recovery. IMPORTANT: Never use shell/terminal to run git commands directly; always use git-mcp MCP tools instead.'
4
+ ---
5
+
6
+ # Git MCP Workflow
7
+
8
+ An MCP-first workflow skill for repositories exposed through `git-mcp`.
9
+
10
+ This skill adapts common Git guidance for a world where the preferred interface is the server's tool catalog, not ad-hoc shell commands. It covers both everyday Git work and the spicier recovery and history-editing cases.
11
+
12
+ ## Why LLMs Must Not Use the Git CLI
13
+
14
+ **Using `git` directly via the shell is highly error-prone for LLMs and should be considered forbidden except as a narrow last resort.**
15
+
16
+ The root cause is structural: Git commands frequently require commit messages, branch names, file paths, and other string arguments that contain spaces, quotes, special characters, or newlines. Shell interpreters handle quoting through multiple layers (single quotes, double quotes, `$'...'` escapes, heredocs) and the rules differ between `sh`, `bash`, and `zsh`. LLMs routinely produce subtly malformed quoting that causes:
17
+
18
+ - Commit messages truncated at the first space or quote character
19
+ - Arguments interpreted as flags (a message starting with `-` becomes a flag)
20
+ - Multi-line messages collapsed to one line or silently dropped
21
+ - Shell word-splitting breaking file paths that contain spaces
22
+ - Quote nesting errors causing the command to hang waiting for a closing delimiter
23
+ - `$` or backtick characters in messages accidentally triggering command substitution
24
+
25
+ These errors are often **silent**: the command appears to succeed, but the result is wrong (e.g., a commit message of `"fix"` instead of `"fix: resolve null pointer in auth handler"`). LLMs typically cannot observe the actual error because the shell may not surface it clearly in the tool output.
26
+
27
+ **The `git-mcp` server solves all of this.** Every tool parameter is a typed, validated field that the server passes directly to `simple-git` as an argument array, bypassing shell interpretation entirely. There are no quoting problems, no interpolation hazards, and no silent truncation.
28
+
29
+ **Rule: Always use `git-mcp` MCP tools for git operations. Never invoke `git` via shell unless the specific operation is genuinely not available through any `git-mcp` tool.**
30
+
31
+ ## When to Use This Skill
32
+
33
+ Use this skill when you need to:
34
+
35
+ - Inspect repository state before making changes
36
+ - Stage, commit, branch, fetch, pull, and push via MCP tools
37
+ - Rebase, cherry-pick, stash, bisect, tag, or use worktrees
38
+ - Recover from resets, detached HEAD, or other Git mishaps
39
+ - Choose between GitHub Flow, classic Git Flow, git-flow-next-style presets, trunk-based, or release workflows
40
+ - Prepare a branch for review or release while preserving safety
41
+ - Explain Git concepts in terms of the `git-mcp` tool surface
42
+
43
+ ## Core Operating Rules
44
+
45
+ ### 1. Start with context, not vibes
46
+
47
+ For any non-trivial task, begin with:
48
+
49
+ 1. `git_context action=summary`
50
+ 2. `git_status action=status`
51
+ 3. Targeted inspection: `git_history action=log`, `git_status action=diff`, `git_history action=show`, or `git_branches action=list`
52
+
53
+ `git_context action=summary` is the default entry point. It reports branch, upstream, pending changes, and in-progress operations (rebase, cherry-pick, merge, bisect).
54
+
55
+ ### 2. Inspect before mutate
56
+
57
+ Prefer read-only calls first:
58
+
59
+ - `git_context action=summary` — repo state snapshot
60
+ - `git_status action=status` — working tree details
61
+ - `git_history action=log` — commit history
62
+ - `git_history action=show ref=<SHA>` — one commit inspection
63
+ - `git_status action=diff mode=unstaged` — unstaged changes
64
+ - `git_history action=blame file_path=<path>` — line attribution
65
+ - `git_history action=reflog` — recovery ledger
66
+ - `git_branches action=list` — local branches
67
+ - `git_remotes action=list` — configured remotes
68
+ - `git_context action=search query=<terms>` — history/code search
69
+ - `git_docs action=man query=<command>` — official docs
70
+
71
+ Only mutate after you understand:
72
+
73
+ - current branch and tracking state
74
+ - whether the tree is clean or dirty
75
+ - whether a merge, rebase, cherry-pick, or bisect is already in progress
76
+
77
+ ### 3. Prefer the safest reversible operation
78
+
79
+ Safety order for undo and recovery:
80
+
81
+ 1. `git_commits action=restore` for uncommitted file changes
82
+ 2. `git_workspace action=stash_all` when switching context without losing work
83
+ 3. `git_commits action=revert` for undoing published commits
84
+ 4. `git_commits action=undo` for soft-resetting the last local commit
85
+ 5. `git_commits action=reset mode=mixed` for local unpublished history
86
+ 6. `git_commits action=reset mode=hard confirm=true` only with explicit user intent
87
+
88
+ Before any history-rewriting step, capture `git_history action=reflog` and `git_history action=log`.
89
+
90
+ ### 4. Treat published history as radioactive
91
+
92
+ Rewriting history is allowed only when the user clearly wants it and the branch is safe to rewrite.
93
+
94
+ - Rebase only on unpublished or explicitly approved branches
95
+ - After rebasing, prefer `git_remotes action=push force_with_lease=true`
96
+ - Avoid unconditional force pushes unless the user explicitly requests them and `GIT_ALLOW_FORCE_PUSH=true` is set server-side
97
+ - Prefer `git_commits action=revert` over reset for shared branches
98
+
99
+ ### 5. Respect hooks and CI
100
+
101
+ Do not bypass hooks casually.
102
+
103
+ - `no_verify` on `git_commits action=commit` and `git_remotes action=push` should stay `false` unless the user explicitly requests a bypass and `GIT_ALLOW_NO_VERIFY=true` is set server-side
104
+ - If hooks fail, fix the root cause
105
+ - In this repository specifically, `.husky/pre-commit` runs `pnpm exec lint-staged` and `pnpm typecheck`
106
+
107
+ ### 6. Use adjacent tooling only where git-mcp stops
108
+
109
+ `git-mcp` covers repository operations, not every GitHub action.
110
+
111
+ - Use GitHub tooling for pull requests, review threads, approvals, and GitHub Releases
112
+ - Use workspace file tools for checking `.gitignore`, worktree directories, and project files
113
+ - **Never invoke `git` via the shell when a `git-mcp` tool exists for that operation.** The quoting hazards described above are not theoretical — they will corrupt commit messages, truncate arguments, and produce silent failures.
114
+
115
+ Narrow cases where CLI may still be necessary (confirm no MCP tool covers it first):
116
+
117
+ - interactive patch staging (`git add -p`)
118
+ - interactive rebase editing for squash/reword/reorder/drop flows
119
+ - `git filter-repo`-style deep history surgery
120
+ - repo-local hook installation commands
121
+
122
+ ## Registered Tool Surface
123
+
124
+ The server exposes these tools (and only these).
125
+
126
+ | Tool | Actions |
127
+ | --------------- | ------------------------------------------------------------------------------------------------------- |
128
+ | `git_context` | `summary` (default), `search`, `get_config`, `set_config`, `aliases` |
129
+ | `git_status` | `status` (default), `diff`, `diff_main` |
130
+ | `git_history` | `log` (default), `show`, `reflog`, `blame`, `lg`, `who` |
131
+ | `git_commits` | `add`, `restore`, `commit`, `reset`, `revert`, `undo`, `nuke`, `wip`, `unstage`, `amend` |
132
+ | `git_branches` | `list` (default), `create`, `delete`, `rename`, `checkout`, `set_upstream`, `recent` |
133
+ | `git_remotes` | `list` (default), `manage`, `fetch`, `pull`, `push` |
134
+ | `git_workspace` | `stash`, `stash_all`, `rebase`, `cherry_pick`, `merge`, `bisect`, `tag`, `worktree`, `submodule` |
135
+ | `git_flow` | `operation=init/overview/config/topic/control` |
136
+ | `git_lfs` | `track`, `untrack`, `ls-files`, `status`, `pull`, `push`, `install`, `migrate-import`, `migrate-export` |
137
+ | `git_docs` | `search`, `man` |
138
+ | `git_ping` | _(health check)_ |
139
+
140
+ See `references/tooling-map.md` for full parameter details.
141
+
142
+ ## Recommended Workflow
143
+
144
+ ### Everyday feature work
145
+
146
+ 1. Orient with `git_context action=summary`
147
+ 2. Inspect with `git_status action=status`, `git_status action=diff`, `git_history action=log`
148
+ 3. Create or switch branches with `git_branches action=create` or `git_branches action=checkout`
149
+ 4. Stage with `git_commits action=add`
150
+ 5. Commit with `git_commits action=commit message="feat: ..."` using Conventional Commit messages
151
+ 6. Sync with `git_remotes action=fetch`, `git_remotes action=pull`, `git_remotes action=push`
152
+ 7. Prepare reviewable history with `git_workspace action=rebase` only if safe and explicitly appropriate
153
+
154
+ ### Advanced work
155
+
156
+ - `git_workspace action=stash_all` — quick context switch without a commit
157
+ - `git_workspace action=rebase` — branch cleanup or rebasing onto upstream
158
+ - `git_workspace action=cherry_pick` — backports and targeted fixes
159
+ - `git_workspace action=bisect` — regression hunting
160
+ - `git_workspace action=worktree` — parallel branch work without stashing
161
+ - `git_workspace action=merge` — merge branches with full flag control
162
+ - `git_workspace action=tag` — release tags
163
+ - `git_workspace action=submodule` — embedded repositories
164
+ - `git_lfs` — large binary assets
165
+ - `git_flow` — scheduled release workflows, preset init, flow overview/config inspection, config CRUD, and finish recovery
166
+
167
+ ## Tool Selection
168
+
169
+ Read `references/tooling-map.md` for the MCP-first command mapping.
170
+
171
+ ## Playbooks
172
+
173
+ Read `references/workflow-playbooks.md` for:
174
+
175
+ - simple feature branch flow
176
+ - review-fix and safe rebase flow
177
+ - recovery after a bad reset or rebase
178
+ - worktree setup guidance
179
+ - backport and release tagging playbooks
180
+ - hooks and CI guidance
181
+
182
+ ## Git Concepts to Explain Clearly
183
+
184
+ When the user needs explanation rather than action, anchor your answer in these concepts:
185
+
186
+ - working tree, index, and committed history
187
+ - branches as movable refs
188
+ - `HEAD` as the current pointer
189
+ - fast-forward versus merge commit history
190
+ - local-only history rewriting versus shared history preservation
191
+ - reflog as the recovery ledger
192
+
193
+ Explain the concept using the MCP tool that reveals it:
194
+
195
+ - status and staging area: `git_status action=status`, `git_status action=diff`, `git_commits action=add`, `git_commits action=restore`
196
+ - refs and branch movement: `git_history action=log`, `git_history action=show`, `git_branches action=list`, `git_history action=reflog`
197
+ - merge and rebase state: `git_context action=summary`, `git_workspace action=rebase`, `git_workspace action=cherry_pick`
198
+
199
+ ## Repository-Specific Notes for `git-mcp`
200
+
201
+ When contributing to this repository itself:
202
+
203
+ - Use Conventional Commits
204
+ - Prefer the documented tool groups in `docs/tools/`
205
+ - Run the full gate before declaring work done:
206
+ - `pnpm typecheck`
207
+ - `pnpm lint`
208
+ - `pnpm format:check`
209
+ - `pnpm test`
210
+ - Remember that the project uses `simple-git`, Zod schemas, and safety-first defaults
211
+
212
+ ## References
213
+
214
+ - `references/tooling-map.md`
215
+ - `references/workflow-playbooks.md`
216
+ - `docs/tools/index.md`
217
+ - `docs/guide/safety.md`
218
+ - `docs/development/contributing.md`
@@ -0,0 +1,390 @@
1
+ # git-mcp Tooling Map
2
+
3
+ This reference translates common Git intentions into the correct `git-mcp` tool calls.
4
+
5
+ > **Never use `git` directly via the shell.** LLMs produce subtly malformed quoting that causes silent failures: commit messages truncated at the first space, arguments interpreted as flags, multi-line text collapsed, paths broken by word-splitting. The `git-mcp` server passes arguments directly to `simple-git` as a typed array—no shell, no quoting hazards, no silent corruption. Use these tools exclusively.
6
+
7
+ ## Canonical Tool Surface
8
+
9
+ The server exposes **7 grouped tools** plus `git_flow`, `git_lfs`, `git_docs`, and `git_ping`. These are the only tools available. Use them exclusively.
10
+
11
+ ---
12
+
13
+ ## `git_context` — Repository context, config, and search
14
+
15
+ **`action=summary`** (default)
16
+
17
+ - High-signal snapshot: branch, upstream, dirty state, in-progress merge/rebase/cherry-pick/bisect
18
+ - Use as the default first call before any non-trivial operation
19
+
20
+ **`action=search`**
21
+
22
+ - Pickaxe/grep search across history; requires `query`
23
+ - Use for bug archaeology and "when was this added?" questions
24
+
25
+ **`action=get_config`**
26
+
27
+ - Read git config; pass `key` for a specific entry, omit for all local config
28
+
29
+ **`action=set_config`**
30
+
31
+ - Write a local git config entry; requires `key` and `value`
32
+
33
+ **`action=aliases`**
34
+
35
+ - List all git aliases configured in the repo
36
+
37
+ ---
38
+
39
+ ## `git_status` — Working tree state and diffs
40
+
41
+ **`action=status`** (default)
42
+
43
+ - Working tree and index state: modified, staged, untracked, conflict markers
44
+
45
+ **`action=diff`**
46
+
47
+ - Show a diff; controlled by `mode`:
48
+ - `unstaged` (default): changes not yet staged
49
+ - `staged`: changes in the index
50
+ - `refs`: diff between two refs; requires `from_ref` and `to_ref`
51
+ - `filtered=true` for an LLM-friendly trimmed view
52
+
53
+ **`action=diff_main`**
54
+
55
+ - Diff of current branch vs `base_branch` (default `main`) using `merge-base`
56
+ - Use before PR creation to see all branch-specific changes
57
+
58
+ ---
59
+
60
+ ## `git_history` — Commit history, blame, and reflog
61
+
62
+ **`action=log`** (default)
63
+
64
+ - Paginated commit log; filter with `author`, `grep`, `since`, `until`, `file_path`
65
+ - Advanced: `first_parent`, `no_merges`, `all_branches`, `simplify_merges`, `order` (default/topo/date/author-date), `revision_range`, `pathspecs`
66
+ - Paginate with `limit` (max 200) and `offset`
67
+
68
+ **`action=show`**
69
+
70
+ - Full patch and metadata for a commit, tag, or ref; requires `ref`
71
+
72
+ **`action=reflog`**
73
+
74
+ - Local HEAD and ref movement history; safety net before any history rewrite
75
+ - Paginate with `limit`
76
+
77
+ **`action=blame`**
78
+
79
+ - Line-level author attribution; requires `file_path`; optional `ref`
80
+
81
+ **`action=lg`**
82
+
83
+ - One-line decorated graph of all branches (`--oneline --graph --decorate --all`)
84
+ - Good for a visual overview of branch topology before rebasing or merging
85
+
86
+ **`action=who`**
87
+
88
+ - Contributor shortlog sorted by commit count; optionally scope to `file_path`
89
+
90
+ ---
91
+
92
+ ## `git_commits` — Staging, committing, and undoing
93
+
94
+ **`action=add`**
95
+
96
+ - Stage files; `all=true` stages everything; `paths` for specific files/dirs
97
+
98
+ **`action=restore`**
99
+
100
+ - Restore paths from index or a ref; requires `paths`
101
+ - `staged=true, worktree=false` → unstage only (keeps working tree edits)
102
+ - `staged=false, worktree=true` → discard working tree changes
103
+ - `source` → restore from a specific ref
104
+
105
+ **`action=commit`**
106
+
107
+ - Create a commit; requires `message`
108
+ - Optional: `all=true` (auto-stage tracked), `sign=true`, `signing_key`, `no_verify`
109
+
110
+ **`action=reset`**
111
+
112
+ - Reset to a ref; `mode`: `soft` / `mixed` (default) / `hard`
113
+ - `target` defaults to HEAD; `paths` for path-limited mixed reset
114
+ - Hard reset requires `confirm=true`
115
+
116
+ **`action=revert`**
117
+
118
+ - Create a revert commit for `ref`; use for shared/published history
119
+ - `no_commit=true` stages the revert without committing
120
+ - `mainline` for merge commits (1 = first parent)
121
+
122
+ **`action=undo`** (convenience)
123
+
124
+ - Soft reset to HEAD~1; keeps changes staged; no extra params needed
125
+
126
+ **`action=nuke`** (convenience, destructive)
127
+
128
+ - Hard reset to HEAD~1; discards the last commit AND all working changes; requires `confirm=true`
129
+
130
+ **`action=wip`** (convenience)
131
+
132
+ - Stages all files and commits with message "WIP"; quick context save before context switch
133
+
134
+ **`action=unstage`**
135
+
136
+ - Moves staged files back to unstaged; requires `paths`
137
+
138
+ **`action=amend`**
139
+
140
+ - Amends the last commit; set `message` to change it, omit + `no_edit=true` to keep it
141
+ - Optional: `sign`, `signing_key`, `no_verify`
142
+
143
+ ---
144
+
145
+ ## `git_branches` — Branch lifecycle
146
+
147
+ **`action=list`** (default)
148
+
149
+ - Local branches; `all=true` includes remote-tracking refs
150
+
151
+ **`action=create`**
152
+
153
+ - Create a branch; requires `name`; `from_ref` sets start point; `create=true` checks it out immediately
154
+
155
+ **`action=delete`**
156
+
157
+ - Delete a local branch; requires `name`; `force=true` bypasses merge check
158
+
159
+ **`action=rename`**
160
+
161
+ - Rename a branch; requires `old_name` and `new_name`
162
+
163
+ **`action=checkout`**
164
+
165
+ - Switch to a branch, tag, or commit; requires `ref`; `create=true` creates the branch first
166
+
167
+ **`action=set_upstream`**
168
+
169
+ - Set a tracking upstream; requires `branch` and `upstream` (e.g. `origin/main`)
170
+
171
+ **`action=recent`**
172
+
173
+ - List N most recently committed branches; defaults to 10; max 100
174
+ - Useful for orientation after returning to a repo
175
+
176
+ ---
177
+
178
+ ## `git_remotes` — Network and remote transport
179
+
180
+ **`action=list`** (default)
181
+
182
+ - List configured remotes with fetch and push URLs
183
+
184
+ **`action=manage`**
185
+
186
+ - Add, remove, or change a remote; requires `remote_action` (`add`/`remove`/`set-url`) and `name`
187
+ - `url` required for `add` and `set-url`
188
+
189
+ **`action=fetch`**
190
+
191
+ - Fetch from remote; optional `remote`, `branch`, `prune` (default true)
192
+ - Advanced: `prune_tags`, `negotiation_tips`, `refspecs`
193
+
194
+ **`action=pull`**
195
+
196
+ - Pull from remote; optional `remote`, `branch`, `rebase`, `ff_only`
197
+ - Advanced: `rebase_mode` (`default`/`merges`/`interactive`), `refspecs`
198
+
199
+ **`action=push`**
200
+
201
+ - Push to remote; optional `remote`, `branch`, `set_upstream`, `tags`
202
+ - Safe force: `force_with_lease=true`
203
+ - Hard force: `force=true` — requires `GIT_ALLOW_FORCE_PUSH=true` server config; disallowed by default
204
+ - Hook bypass: `no_verify=true` — requires `GIT_ALLOW_NO_VERIFY=true` server config; disallowed by default
205
+ - Advanced: `refspecs`, `push_options`, `atomic`
206
+
207
+ ---
208
+
209
+ ## `git_workspace` — Stash, rebase, cherry-pick, merge, bisect, tag, worktree, submodule
210
+
211
+ ### `action=stash`
212
+
213
+ - `stash_action`: `save` / `list` / `apply` / `pop` / `drop`
214
+ - `message`: optional stash label; `index`: stash slot for apply/pop/drop
215
+ - `include_untracked=true`: include untracked files in save
216
+
217
+ ### `action=stash_all` (convenience)
218
+
219
+ - Stages all untracked files then stashes everything; equivalent to `git stash -u`
220
+ - Optional `message`
221
+
222
+ ### `action=rebase`
223
+
224
+ - `rebase_action`: `start` / `continue` / `abort` / `skip`
225
+ - For start: `rebase_upstream` (required) is the base ref to rebase onto
226
+ - Onto rebasing: set both `rebase_onto` (new base) and `rebase_upstream` (old base)
227
+ - `rebase_branch`: optional branch to rebase (defaults to HEAD)
228
+ - Flags: `rebase_interactive`, `rebase_autosquash`, `rebase_merges`
229
+
230
+ ### `action=cherry_pick`
231
+
232
+ - `cherry_pick_action`: `start` / `continue` / `abort`
233
+ - For start: `cherry_pick_refs` (array of SHAs) or `ref` (single commit)
234
+ - Flags: `cherry_pick_mainline` (for merge commits), `cherry_pick_record_origin` (-x), `cherry_pick_no_commit`
235
+ - Advanced: `cherry_pick_strategy`, `cherry_pick_strategy_options`
236
+
237
+ ### `action=merge`
238
+
239
+ - `merge_action`: `start` / `continue` / `abort`
240
+ - For start: `merge_refs` (array) or `ref` (single)
241
+ - Flags: `merge_no_ff`, `merge_ff_only`, `merge_squash`, `merge_no_commit`, `merge_log`
242
+ - Advanced: `merge_strategy`, `merge_strategy_options`, `conflict_style` (`merge`/`diff3`/`zdiff3`)
243
+
244
+ ### `action=bisect`
245
+
246
+ - `bisect_action`: `start` / `good` / `bad` / `skip` / `run` / `reset`
247
+ - For start: `good_ref` and `bad_ref`
248
+ - For `run`: `command` (shell command run at each bisect step)
249
+ - `ref`: for manual good/bad/skip marking mid-session
250
+
251
+ ### `action=tag`
252
+
253
+ - `tag_action`: `list` / `create` / `delete`
254
+ - For create: `name` required; `target` (defaults HEAD), `message` for annotated, `sign`, `signing_key`
255
+
256
+ ### `action=worktree`
257
+
258
+ - `worktree_action`: `add` / `list` / `remove` / `lock` / `unlock` / `prune` / `repair`
259
+ - For add: `path` (required), `branch`; flags: `worktree_force`, `worktree_detached`, `worktree_lock_reason`
260
+ - For remove: `path` (required), `worktree_force`
261
+ - For lock/unlock: `path` (required); lock accepts `worktree_lock_reason`
262
+ - For prune: `worktree_expire` (e.g. `2.weeks.ago`)
263
+ - For repair: `paths` (array of worktree paths to repair)
264
+
265
+ ### `action=submodule`
266
+
267
+ - `submodule_action`: `add` / `list` / `update` / `sync` / `foreach` / `set_branch`
268
+ - For add: `url` and `path` required
269
+ - For update: `recursive` (default true), `submodule_remote`, `submodule_depth`, `submodule_jobs`; optional `paths`
270
+ - For foreach: `command` required, `recursive`
271
+ - For set_branch: `branch` and `path` required
272
+
273
+ ---
274
+
275
+ ## `git_flow` — Git Flow and git-flow-next workflows
276
+
277
+ - `operation=overview` or `action=overview`: show current flow state before mutating
278
+ - Canonical form: `operation` (`init`/`overview`/`config`/`topic`/`control`) + sub-action
279
+ - `topic_action`: `start`/`finish`/`publish`/`list`/`update`/`delete`/`rename`/`checkout`/`track`
280
+ - `control_action`: `continue` / `abort` (when a finish pauses on a conflict)
281
+ - `config_action`: `add`/`update`/`rename`/`delete`
282
+
283
+ - Key params: `topic` (branch type), `name`, `start_point`, `base_ref`, `preset` (classic/github/gitlab)
284
+ - Merge/integration: `upstream_strategy`, `downstream_strategy`, `ff`, `keep_branch`, `rebase_before_finish`, `publish`
285
+ - Set `GIT_ALLOW_FLOW_HOOKS=true` in the server environment to allow hook execution
286
+
287
+ ---
288
+
289
+ ## `git_lfs` — Large File Storage
290
+
291
+ **actions**: `track` / `untrack` / `ls-files` / `status` / `pull` / `push` / `install` / `migrate-import` / `migrate-export`
292
+
293
+ - `patterns`: glob array for track/untrack
294
+ - `remote`: for pull/push
295
+ - `include` / `exclude`: comma-separated patterns for migrate and pull
296
+ - `everything=true`: include all refs in push/migrate
297
+
298
+ ---
299
+
300
+ ## `git_docs` — Official Git documentation
301
+
302
+ **`action=search`**
303
+
304
+ - Full-text search of git-scm.com; `query` = search terms
305
+
306
+ **`action=man`**
307
+
308
+ - Fetch the man page for a command; `query` = command name without `git-` prefix (e.g. `rebase`, `commit`)
309
+
310
+ ---
311
+
312
+ ## `git_ping`
313
+
314
+ - Health check; no required parameters. Returns server name and a configurable `message`.
315
+
316
+ ---
317
+
318
+ ## Quick-reference cheat-sheet
319
+
320
+ | Intent | Tool | Key params |
321
+ | ------------------------ | --------------- | ---------------------------------------------------------------------- |
322
+ | Orient to repo | `git_context` | `action=summary` |
323
+ | Search history | `git_context` | `action=search, query=...` |
324
+ | Read config | `git_context` | `action=get_config, key=...` |
325
+ | Working tree status | `git_status` | `action=status` |
326
+ | Unstaged diff | `git_status` | `action=diff, mode=unstaged` |
327
+ | Staged diff | `git_status` | `action=diff, mode=staged` |
328
+ | Branch vs main diff | `git_status` | `action=diff_main` |
329
+ | Commit log | `git_history` | `action=log` |
330
+ | Graph view | `git_history` | `action=lg` |
331
+ | Show a commit | `git_history` | `action=show, ref=...` |
332
+ | Reflog (recovery) | `git_history` | `action=reflog` |
333
+ | Blame a file | `git_history` | `action=blame, file_path=...` |
334
+ | Who contributed | `git_history` | `action=who` |
335
+ | Stage files | `git_commits` | `action=add, paths=[...]` |
336
+ | Stage all | `git_commits` | `action=add, all=true` |
337
+ | Unstage | `git_commits` | `action=unstage, paths=[...]` |
338
+ | Discard working changes | `git_commits` | `action=restore, paths=[...], worktree=true` |
339
+ | Commit | `git_commits` | `action=commit, message=...` |
340
+ | Amend | `git_commits` | `action=amend` |
341
+ | Soft undo | `git_commits` | `action=undo` |
342
+ | Quick WIP save | `git_commits` | `action=wip` |
343
+ | Revert shared commit | `git_commits` | `action=revert, ref=...` |
344
+ | List branches | `git_branches` | `action=list` |
345
+ | Recent branches | `git_branches` | `action=recent` |
346
+ | Create branch | `git_branches` | `action=create, name=..., from_ref=..., create=true` |
347
+ | Switch branch | `git_branches` | `action=checkout, ref=...` |
348
+ | Delete branch | `git_branches` | `action=delete, name=...` |
349
+ | Set upstream | `git_branches` | `action=set_upstream, branch=..., upstream=...` |
350
+ | Fetch | `git_remotes` | `action=fetch` |
351
+ | Pull | `git_remotes` | `action=pull` |
352
+ | Pull with rebase | `git_remotes` | `action=pull, rebase=true` |
353
+ | Push | `git_remotes` | `action=push` |
354
+ | Safe force push | `git_remotes` | `action=push, force_with_lease=true` |
355
+ | Stash all incl untracked | `git_workspace` | `action=stash_all` |
356
+ | Save stash | `git_workspace` | `action=stash, stash_action=save` |
357
+ | Pop stash | `git_workspace` | `action=stash, stash_action=pop` |
358
+ | Rebase onto upstream | `git_workspace` | `action=rebase, rebase_action=start, rebase_upstream=...` |
359
+ | Cherry-pick | `git_workspace` | `action=cherry_pick, cherry_pick_action=start, cherry_pick_refs=[...]` |
360
+ | Merge branch | `git_workspace` | `action=merge, merge_action=start, merge_refs=[...]` |
361
+ | Bisect | `git_workspace` | `action=bisect, bisect_action=start, good_ref=..., bad_ref=...` |
362
+ | Create annotated tag | `git_workspace` | `action=tag, tag_action=create, name=..., message=...` |
363
+ | Add worktree | `git_workspace` | `action=worktree, worktree_action=add, path=..., branch=...` |
364
+ | Git Flow feature start | `git_flow` | `operation=topic, topic_action=start, topic=feature, name=...` |
365
+ | Git Flow release finish | `git_flow` | `operation=topic, topic_action=finish, topic=release, name=...` |
366
+ | LFS track patterns | `git_lfs` | `action=track, patterns=[...]` |
367
+ | Read git man page | `git_docs` | `action=man, query=rebase` |
368
+
369
+ ---
370
+
371
+ ## Safety defaults
372
+
373
+ - Always call `git_context action=summary` before mutating
374
+ - Prefer `git_commits action=revert` over reset for published history
375
+ - Capture `git_history action=reflog` before risky history changes
376
+ - Prefer `force_with_lease=true` on `git_remotes action=push` over `force=true`
377
+ - Hard reset and `action=nuke` require `confirm=true`
378
+ - Do not set `no_verify=true` unless the user explicitly requests it and `GIT_ALLOW_NO_VERIFY=true` is set server-side
379
+
380
+ ---
381
+
382
+ ## Capabilities not covered by git-mcp
383
+
384
+ Use adjacent tooling or, if unavoidable, the shell only for:
385
+
386
+ - Interactive patch staging (`git add -p`)
387
+ - Interactive rebase editing (squash/fixup/reword/reorder/drop choreography needing a text editor)
388
+ - Repository-wide history rewriting (`git filter-repo`)
389
+ - GitHub PR lifecycle and release object management
390
+ - Project-specific hook installation commands