Skip to content
Development
Skill

/git-operations

Git command patterns, branching strategy, and safety protocols. TRIGGER when: managing branches, resolving merge conflicts, or running commit/merge/push operations. SKIP: worktree lifecycle and isolation recovery (use worktree-management); CI automation (use

From plugin
scaffolding
1639 skills13 agents21 commands25 hooks

Claude Code

$ npx -y skills add komluk/scaffolding --skill git-operations --agent claude-code

SKILL.md

git-operations.SKILL.md
name: git-operations
description: "Git command patterns, branching strategy, and safety protocols. TRIGGER when: managing branches, resolving merge conflicts, or running commit/merge/push operations. SKIP: worktree lifecycle and isolation recovery (use worktree-management); CI automation (use github-actions-template)."

Git Operations Skill

Purpose

Core git command patterns, branching strategies, and safety protocols for a project.

Current branch: !`git branch --show-current 2>/dev/null || true`

Branching Convention

| Branch Pattern | Purpose | |----------------|---------| | `main` | Production branch, always stable | | `scaffolding/{task_id[:12]}` | Worktree task branches (auto-created) | | `backup/{task_id[:12]}` | Safety backup before destructive ops |

Safe Operation Patterns

Before Any Destructive Operation

git status
git stash list
git log --oneline -5
git branch backup/$(date +%s) HEAD

Merge Strategy

git merge --no-commit --no-ff branch_name
git diff --cached --stat
git merge --continue  # or --abort

Conflict Resolution

git diff --name-only --diff-filter=U
git checkout --ours path/to/file    # keep ours
git checkout --theirs path/to/file  # keep theirs

Cherry-Pick

git cherry-pick --no-commit <commit>
git diff --cached --stat
git cherry-pick --continue

Common Error Patterns

| Error | Fix | |-------|-----| | `fatal: not a git repository` | Verify path, check .git exists | | `CONFLICT (content)` | Use conflict resolution protocol | | `cannot lock ref` | Wait and retry, check stale locks | | `worktree is not clean` | Stage+commit or stash |

Push Operations

Standard Push (after workflow)

# 1. Verify unpushed commits exist
git log --oneline origin/main..HEAD

# 2. Push to remote
git push origin main

# 3. Verify push succeeded
git log --oneline origin/main..HEAD  # should be empty

Push Safety Rules

  • NEVER use `--force` or `--force-with-lease` without explicit user confirmation
  • Always verify unpushed commits BEFORE push
  • Always verify push success AFTER push
  • If push fails due to divergence, report to user -- do NOT auto-rebase

Finishing Flow

After work is complete on a branch, execute one of these four actions based on context.

Merge to Main

git checkout main
git merge --ff-only <branch>  # try fast-forward first
# if ff fails: git merge --no-ff <branch>
# MANDATORY cleanup -- see Post-Merge Cleanup

Post-Merge Cleanup (MANDATORY final step of every merge)

Applies to ff, `--no-ff`, and squash merges (PR merged via `gh`/Gitea too). Squash merges are invisible to `git branch --merged`.

# from the main checkout, never from inside the worktree
git -C <worktree> status --porcelain --untracked-files=no   # must be empty
git worktree remove <worktree>        # --force only for untracked build output (node_modules)
git branch -D <branch>
git worktree prune
  • Uncommitted tracked changes -> REFUSE, keep worktree + branch, report the files.
  • Never delete remote branches here. Never touch the main checkout.
  • Put the result in the final report (Worktree Cleanup table).
  • Stale leftovers: `/worktree-gc` (dry run by default).

Create PR

git push -u origin <branch>
gh pr create --title "<title>" --body "<body>"
# keep branch and worktree

Keep Branch

# no action needed -- branch stays as-is
git push -u origin <branch>  # optional: push to remote for safety

Discard Branch

git checkout main
git worktree remove .scaffolding/worktrees/<task_id> 2>/dev/null
git branch -D <branch>
git worktree prune
Read more
@komluk
Ships withscaffolding

Spec-driven multi-agent orchestration for Claude Code — pure markdown, zero backend, runs on the stock runtime. 13 agents, 39 skills, 21 commands, 20 hooks, per-phase model tiers, opt-in lifecycle hooks, optional cross-device semantic memory.

1639 skills13 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
16
Star history of komluk/scaffolding on GitHub, a chart by star-history.com

Other skills on scaffolding.

agent-comms

agent-comms

SendMessage recipient validation and worktreePath safety (CWE-59). TRIGGER when: validating a SendMessage `to:` recipient against…

@komluk@komlukInstall Skill
agent-memory

agent-memory

Repo-local file memory under .scaffolding/ (shared/agent/conversation tiers). TRIGGER when: reading or writing .scaffolding/…

@komluk@komlukInstall Skill
api-design

api-design

RESTful API design standards: resource naming, HTTP methods, status codes, pagination, versioning. TRIGGER when: designing new…

@komluk@komlukInstall Skill
context-engineering

context-engineering

Optimize Claude Code context-window usage for accuracy and cost. TRIGGER when: hitting context limits, structuring prompts for an…

@komluk@komlukInstall Skill
database-optimization

database-optimization

Schema design, index strategy, migration safety, and query analysis. TRIGGER when: designing tables or indexes, writing a…

@komluk@komlukInstall Skill
distill

distill

Knowledge distillation: candidate extraction, confidence scoring, tier routing. Invoked by /learn and the memory-ingest Stop…

@komluk@komlukInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills11d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react2d252k
@facebook@facebookInstall Skill

Questions about git-operations.

Which coding agents can use git-operations?
git-operations installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.