Git Workflow Guide

Guides a safe branch, PR, rebase and merge flow — explains trunk-based vs git-flow and stops you from force-pushing a branch other people share.

Reviewed Jul 7, 2026DevOps & Gitby AI World InformationMIT

What this skill does

Key features

  • Recommends a branching model (trunk-based vs git-flow) for your situation
  • Walks through branch, commit, rebase, PR and merge steps in order
  • Warns before any force-push that could clobber a shared branch
  • Explains rebase vs merge trade-offs so you pick deliberately
  • Encourages small, reviewable commits over one giant change

Use cases

  • Onboarding a developer to a team's git conventions
  • Deciding between trunk-based and git-flow for a new repo
  • Recovering safely from a tangled branch without losing work

SKILL.md

The skill definition — its metadata and the exact instructions an agent follows. Copy it into a SKILL.md file in your agent's skills folder.

namegit-workflow
descriptionAdvise on safe git branching, PR, rebase and merge workflows without executing destructive commands.
allowed-toolsRead, Bash(git status:*), Bash(git log:*), Bash(git branch:*)
outputworkflow guidance
safetyread-only advice

Musts

  • Inspect current state with git status and git branch before advising any step.
  • Never recommend git push --force against a shared branch; suggest --force-with-lease on a personal branch only.
  • Keep the target branch (main/trunk) protected — advise all changes land through a pull request.
  • Explain the trade-off whenever rebase and merge both apply, then let the user choose.
  • Ask the user to run any command that rewrites history; do not run it for them.

Guidelines

  • Prefer short-lived feature branches and small commits over long-running divergence.
  • Rebase your own unpushed work to keep history linear; merge when a branch is shared.
  • Pull with --rebase on feature branches to avoid noisy merge commits.

Output format

Branching model: trunk-based (frequent deploys, small team)

1. git switch -c feat/login-rate-limit
2. commit in small steps
3. git pull --rebase origin main
4. open a PR; request review
5. squash-merge once approved

Warning: do not force-push main. Use --force-with-lease only on
feat/login-rate-limit, which is yours.

FAQ

Will it force-push or rewrite history for me?
No. It explains the commands and their risks and asks you to run anything that rewrites history. It flags force-push to shared branches as unsafe and suggests --force-with-lease on your own branch instead.
Trunk-based or git-flow — which should I use?
It depends on release cadence and team size. Trunk-based suits frequent deploys with short-lived branches; git-flow suits versioned releases with parallel maintenance. The skill asks about your setup before recommending one.

Before running any skill, read its instructions and the tools it's allowed to use, and test it on a safe target first. See LLM security best practices.