← LeaderboardThe Skill Leaderboard

moai-ref-git-workflow

Git workflow patterns, branch strategies, conventional commits, and PR templates reference for git operations. Agent-extending skill that amplifies manager-git expertise with production-grade git workflow patterns. NOT for: code implementation, testing, architecture design, documentation content.

Published by modu-ai ↗modu-ai/moai-adk

Try your first task

A source-grounded starter task has not been verified for this skill yet.

SKILL.md

name: moai-ref-git-workflowdescription: >  Git workflow patterns, branch strategies, conventional commits, and PR templates  reference for git operations. Agent-extending skill that amplifies manager-git  expertise with production-grade git workflow patterns.  NOT for: code implementation, testing, architecture design, documentation content.when_to_use: >  Use for git workflow reference: branch strategies, conventional commits,  PR templates, merge and rebase flows, and commit/branch/release  conventions. Amplifies manager-git expertise with production-grade git  workflow patterns.user-invocable: falsemetadata:   version: "1.0.0"  category: "workflow"  status: "active"  updated: "2026-03-30"  tags: "git, branch, commit, pr, workflow, reference"# MoAI Extension: Progressive Disclosureprogressive_disclosure:   enabled: true  level1_tokens: 100  level2_tokens: 3000

Git Workflow Reference

Target Agent

manager-git - Applies these patterns directly to git operations, branch management, and PR creation.

Branch Strategy Patterns

GitHub Flow (Default for Most Projects)

main ─────────────────────────────────────────
  └── feat/SPEC-XXX-description ──── PR ──→ merge

Rules:

  • main is always deployable
  • Feature branches from main
  • PR required for all merges
  • Delete branch after merge

GitFlow (Complex Release Cycles)

main ──────────────────────────────────────────
  └── develop ─────────────────────────────────
        ├── feature/SPEC-XXX ──── PR ──→ develop
        └── release/v1.2.0 ────── PR ──→ main + develop

Agentic-Trunk (Local Batch Landing)

git_strategy.manual.workflow: agentic-trunk names the model MoAI-ADK's own factory runs on:

main ──────────────────────────────────────────
  └── WT-card-slug ── integration-worktree merge ──→ batch PR (release/main-batch-YYYYMMDD) ──→ tagged release

Rules:

  • One standing trunk main; card worktrees branch from it
  • Two delivery routes, decided by which tree holds main: when a dedicated integration worktree holds it, cards land serially there (--no-ff, no per-card pull request); when only the primary checkout holds it, moai factory complete opens the card's pull request and the leader merges it
  • With the dedicated integration worktree, the leader opens one batch pull request per lead_push_threshold landings
  • Lanes take no per-version release branch and run no lane push

Trunk-Based (CI/CD Heavy)

main ──────────────────────────────────────────
  └── short-lived branch (< 1 day) ──→ merge

Branch Naming Convention

PatternExampleUse Case
feat/SPEC-{ID}-{slug}feat/SPEC-AUTH-001-jwt-authNew feature
fix/SPEC-{ID}-{slug}fix/SPEC-BUG-042-null-checkBug fix
refactor/{slug}refactor/extract-auth-middlewareRefactoring
docs/{slug}docs/api-reference-updateDocumentation
chore/{slug}chore/upgrade-dependenciesMaintenance

Conventional Commits Reference

TypeWhenExample
featNew featurefeat(auth): add JWT refresh token flow
fixBug fixfix(api): handle null user in profile endpoint
refactorCode restructurerefactor(db): extract query builder
testTest changestest(auth): add login edge case tests
docsDocumentationdocs(api): update endpoint descriptions
choreMaintenancechore(deps): upgrade Go to 1.23
perfPerformanceperf(query): add index for user lookup
styleFormattingstyle: apply gofmt formatting
ciCI/CD changesci: add GitHub Actions workflow
revertRevert commitrevert: undo feat(auth) commit abc123

Commit Message Structure

<type>(<scope>): <description>    # max 72 chars

[optional body]                    # what and why, not how

[optional footer]                  # Breaking changes, issue refs
BREAKING CHANGE: <description>
Refs: #123, SPEC-AUTH-001

Pull Request Template

## Summary
- [1-3 bullet points describing what this PR does]

## Changes
- [ ] File 1: description of change
- [ ] File 2: description of change

## Test Plan
- [ ] Unit tests added/updated
- [ ] Integration tests pass
- [ ] Manual testing completed

## SPEC Reference
- SPEC-{ID}: {title}

## Checklist
- [ ] Tests pass (project test command)
- [ ] Lint and format pass (project toolchain)
- [ ] No secrets committed
- [ ] Documentation updated if needed

Merge Strategy Selection

StrategyWhenCommand
Squash mergeFeature branches (clean history)gh pr merge --squash
Merge commitRelease branches (preserve history)gh pr merge --merge
RebaseSmall, clean commitsgh pr merge --rebase

The active method for sync-phase PR auto-merge is governed by the git_strategy.<mode>.merge_method config value (squash | merge | rebase; default squash), not hardcoded. The sync agent resolves it from the active mode profile and renders the matching gh pr merge --<merge_method> command.

Git Safety Rules

ActionRiskRule
git push --forceOverwrites remoteNEVER on main/master, ask user first
git reset --hardLoses local changesConfirm with user first
git checkout .Discards changesConfirm with user first
git branch -DDeletes branchOnly after merge confirmed
--no-verifySkips hooksNEVER unless user explicitly requests
git rebase -iInteractive (not supported)NEVER use (requires interactive input)

Context Memory in Commits

Embed decision context in commit messages for future session continuity:

feat(auth): implement JWT refresh token rotation

Decision: Chose rotation over sliding window for security
Pattern: Middleware chain: RateLimit -> Auth -> Authz -> Handler
Gotcha: Token blacklist requires Redis, not just in-memory cache

Refs: SPEC-AUTH-001

Common Rationalizations

RationalizationReality
"I will clean up the commit messages before merging"Interactive rebase is error-prone under pressure. Write clean commits from the start.
"Force push is fine on my feature branch"Collaborators or CI may have fetched the branch. Force push destroys their reference. Use --force-with-lease.
"This commit is too small to need a conventional format"Changelog generators, bisect, and blame all depend on consistent commit formats. Every commit matters.
"I will push directly to main, it is a small fix"Direct pushes bypass code review and CI. Even small fixes can break production.
"Merge commits are messy, I always squash"Squash loses individual commit context. Merge commits preserve the development narrative for future debugging.

Red Flags

  • Commit message does not follow conventional format (type(scope): description)
  • Force push to main or shared release branch
  • PR merged without CI passing
  • Branch name does not indicate feature, fix, or SPEC reference
  • Merge conflict markers found in committed files

Verification

  • All commit messages follow conventional format (show git log --oneline)
  • Branch name follows convention (feat/, fix/, refactor/, docs/, chore/ prefix)
  • No force pushes to main or protected branches (check reflog or CI)
  • PR has passing CI checks before merge
  • No merge conflict markers in committed files (grep for <<<<<<<)
  • SPEC-ID referenced in commit message or PR description when applicable