agentleFS
octivioctivi/skills/git-trunk-based-workflow/SKILL.md

git-trunk-based-workflow

Skill1 starsChanged 5 months agoMITView on GitHub

Plan and execute Git Trunk-Based Development workflows on a repository with main as trunk. Use whenever the user asks about branch strategy, branch naming, rebasing on main, merge conflicts during rebase, PR flow, merge strategy, safe history rewrite, or branch cleanup, even if they do not mention "trunk-based" explicitly. For commit message formatting and Conventional Commits wording, delegate to git-commits.

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 8 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Keep main releasable while integrating small changes frequently and predictably.

    line 12
  2. Distinctive:

    Use this table as the single source of truth for workflow decisions.

    line 16
  3. Very specific:

    Run before creating/rebasing/merging branches:

    line 33
  4. Distinctive:

    If working tree is not clean, pause and either commit, stash, or discard changes before proceeding.

    line 40
  5. Distinctive:

    When git rebase stops on conflict:

    line 44
  6. Distinctive:

    If you need to cancel the rebase:

    line 53
  7. Very specific:

    Run Branch state preflight and confirm current goal.

    line 61
  8. Distinctive:

    Create or switch to a short-lived feature branch from up-to-date main.

    line 62
  9. Distinctive:

    Commit and push incremental progress to the feature branch.

    line 63
  10. Very specific:

    If rebase conflicts occur, execute Rebase conflict handling.

    line 65
  11. Very specific:

    Commit message wording/formatting and Conventional Commits phrasing belong to git-commits.

    line 74
  12. Distinctive:

    No recommendation conflicts with repository branch policy (main as trunk).

    line 80
  13. Very specific:

    If user asks about commit message style, explicitly route to git-commits.

    line 82

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Git Trunk-Based Workflow

Guide contributors through a safe trunk-based Git workflow.

Goal

Keep main releasable while integrating small changes frequently and predictably.

Canonical rules table

Use this table as the single source of truth for workflow decisions.

IDScopeRequirement
WF-1Trunk policyNever commit directly to main; use short-lived feature branches and pull requests.
WF-2Branch lifecycleFeature branches SHOULD stay focused and short-lived; delete branches after merge.
WF-3IntegrationRebase feature branch on top of main frequently to minimize integration drift.
WF-4History rewriteIf branch history was rewritten (rebase/squash), push with --force-with-lease only.
WF-5PR qualityOpen PR to main, keep CI green, and address review feedback before merge.
WF-6Merge modePrefer standard repository merge path (typically GitHub UI) unless local merge is required.
WF-7CleanupAfter merge, clean up local/remote branch references.
WF-8SafetyCommands provided to users MUST be copy-paste ready and scoped to their current step.
WF-9PreflightBefore branch operations, verify current branch and working tree state.
WF-10Conflict recoveryRebase guidance MUST include safe conflict resolution (--continue / --abort).

Branch state preflight

Run before creating/rebasing/merging branches:

git branch --show-current
git status --short

If working tree is not clean, pause and either commit, stash, or discard changes before proceeding.

Rebase conflict handling

When git rebase stops on conflict:

git status
# resolve conflicts in files
git add <resolved-file>...
git rebase --continue

If you need to cancel the rebase:

git rebase --abort

Authoring workflow

  1. Run Branch state preflight and confirm current goal.
  2. Create or switch to a short-lived feature branch from up-to-date main.
  3. Commit and push incremental progress to the feature branch.
  4. Rebase feature branch onto main frequently (use --rebase-merges only when needed).
  5. If rebase conflicts occur, execute Rebase conflict handling.
  6. Optionally clean branch history before opening PR.
  7. Open and land PR to main with green CI and addressed feedback.
  8. Clean up merged branches locally and remotely.

For full command sequences and edge-case notes, use references/git-workflow.md.

Out of scope

  • Commit message wording/formatting and Conventional Commits phrasing belong to git-commits.

Quality checklist

  • Guidance conforms to all applicable WF-* rules.
  • Commands are copy-paste ready and ordered by execution flow.
  • No recommendation conflicts with repository branch policy (main as trunk).
  • Preflight and rebase conflict recovery commands are included when relevant.
  • If user asks about commit message style, explicitly route to git-commits.

Prompt templates

  • Propose a trunk-based git workflow for implementing this task from branch creation to merge.
  • Review my current git commands and rewrite them to follow a safe rebase + PR flow on main.
  • Give me a step-by-step checklist to clean up history and merge this feature branch into main.

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.