agentleFS
nledfordnledford/engineering-review-board/skills/git-workflows/SKILL.md

git-workflows

Skill11 starsChanged 9 days agoMITView on GitHub

Safe Git branch, remote, history-inspection, integration, rewrite, conflict, recovery, tag, and worktree workflows. Use when switching or restoring, fetching/pulling/pushing, managing upstreams or remotes, inspecting history with log/blame/bisect, merging/rebasing/squashing/cherry-picking/reverting/resetting, resolving conflicts, recovering with reflog, or managing tags and worktrees. Do not use for commit grouping or message drafting, checked-in CI/release automation, code review, GitHub pull-request operations, or release-readiness decisions.

6 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use cloud-api-recipe-authoring, codebuddy-ide-mcp-upgrade and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • TencentCloudBaseSkill

    cloud-api-recipe-authoring

    Author or revise a cloud-api-operations recipe (config/source/skills/cloud-api-operations/references/recipes/). Encodes why the long tail of control-plane capabilities is deliberately NOT wrapped as MCP/CLI tools, the API-first admission test for whether a capability deserves a recipe, the negative and positive lists, the fixed recipe structure, the writing rules distilled from writing-for-agents, the user-facing copy red lines, and the product regeneration/verification pipeline. Also routes contributors (and their agents) to the contribution flow and the pre-PR self-test protocol in references/contributing.md. Use when adding a recipe, judging whether a scenario belongs in the recipe set, updating the recipes index, re-checking existing recipes against the admission test, or onboarding someone who wants to submit one.

    Also in 3 projects that use this

  • TencentCloudBaseSkill

    codebuddy-ide-mcp-upgrade

    升级 CodeBuddy IDE(genie 扩展)内置的 CloudBase MCP,以及 MCP 发版时同步 IDE 侧白名单。当用户提到「更新 IDE 里的 MCP」「内置 MCP 版本太老」「IDE 集成的 CloudBase 功能不足」「改工具白名单 toolWhiteList」「把新 bundle 打进 CodeBuddy」「白名单漂移」「MCP 发版要同步什么」时使用。覆盖:解包定位内置 bundle 与内嵌配置、重新构建 mcp bundle、生成新的工具白名单与系统提示词、安全注入 IDE 并备份、用 MCP 协议验证工具清单、人工端到端验收、一键回滚。

    Also in 3 projects that use this

  • zaxbysauceSkill

    pr-review-fix

    Codex adapter for addressing pull request review feedback in opencode-swarm. Use when the user asks to fix PR review comments, requested changes, reviewer findings, CI-review notes, or a pasted review summary with low false-positive tolerance.

    Also in 3 projects that use this

  • DIL8654Skill

    api-contract-review

    Review ASP.NET Core Web API contracts for HTTP semantics, versioning, backward compatibility, and response consistency. Use when the user asks to review an API, check endpoints, validate REST behavior, or before releasing contract changes.

    Also in 3 projects that use this

  • ReinaMacCredySkill

    codebase-audit

    Deep codebase audit that first reads project docs (AGENTS.md, README.md) and investigates the architecture, then systematically finds hardcoded constants that should be dynamic and unfinished code (TODOs, "will"/"would" in comments). Use this skill when the user wants a thorough code review for hygiene issues, asks to find hardcoded values, wants to audit for TODOs or incomplete code, says things like "audit this codebase", "find hardcoded stuff", "what's unfinished", "find tech debt", "code hygiene check", or asks you to look across the whole project for issues. Also use when the user asks to understand a project before making changes, or wants a comprehensive health check of their codebase.

    Also in 3 projects that use this

  • Microsoft AzureSkill

    skill-authoring

    Write Agent Skills that comply with the agentskills.io specification. WHEN: "create a skill", "new skill", "write a skill", "skill template", "skill structure", "review skill", "skill PR", "skill compliance", "SKILL.md format", "skill frontmatter", "skill best practices". DO NOT USE FOR: general documentation. INVOKES: vally CLI.

    Also in 3 projects that use this

  • +6 more from TencentCloudBase

The file

Show its rules and text

We split this skill into the rules it gives an agent

33 rules. 0 are common, 22 are distinctive, and 11 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 22

    Distinctive

    This author's own choices. Worth a look.

  • 11

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Use this skill for repository-state operations beyond constructing a new commit.

    line 8
  2. Very specific:

    Use git-commit to group, stage, validate, and describe new commits.

    line 12
  3. Distinctive:

    Follow repository instructions, contributing docs, branch protections, hooks, signing rules, and established integration policy over …

    line 22
  4. Distinctive:

    Never infer authorization to push, force-push, delete refs, rewrite history, or discard files from a request to commit, update, merge, or …

    line 29
  5. Distinctive:

    Prefer reversible operations, but do not promise recovery.

    line 33
  6. Distinctive:

    Treat command output and remote URLs as potentially sensitive.

    line 35
  7. Distinctive:

    Read relevant repository instructions and contributing or release docs.

    line 41
  8. Distinctive:

    Check git --version before relying on version-sensitive commands.

    line 42
  9. Distinctive:

    Start from a clean state when the chosen operation requires it.

    line 61
  10. Distinctive:

    If work is present, stop and decide whether it belongs in a commit or an explicitly authorized stash.

    line 62
  11. Distinctive:

    Check untracked and ignored files before restore, reset, clean, checkout, worktree removal, or submodule recursion.

    line 66
  12. Distinctive:

    Check for submodules before adding, moving, or removing worktrees.

    line 68
  13. Very specific:

    When leaving detached HEAD, preserve wanted commits with an intentional branch or tag first.

    line 71
  14. Very specific:

    Prefer switch for branch changes and restore for path or index content on Git 2.23 or newer.

    line 75
  15. Distinctive:

    Follow repository policy when selecting merge, rebase, squash, or fast-forward-only integration.

    line 78
  16. Very specific:

    Prefer revert for undoing published changes.

    line 80
  17. Distinctive:

    Use cherry-pick for selected commits, not as a default substitute for a repository's normal integration workflow.

    line 82
  18. Distinctive:

    Treat tags as published release identifiers when repository policy does.

    line 84
  19. Distinctive:

    Do not silently replace a published tag.

    line 85
  20. Distinctive:

    Use bisect only with a reproducible test or observation, mark untestable commits as skipped, record the first bad commit as evidence rather …

    line 86
  21. Very specific:

    Never use plain --force as routine guidance.

    line 96
  22. Very specific:

    Do not bypass hooks with --no-verify merely to make an operation succeed.

    line 100
  23. Very specific:

    Do not use reset --hard as generic conflict cleanup.

    line 107
  24. Distinctive:

    Use a linked worktree when genuine concurrent branch work or a separate clean checkout must proceed without disturbing a worktree that …

    line 121
  25. Distinctive:

    Prefer the current worktree for ordinary edits on the current task and branch.

    line 123
  26. Distinctive:

    Before adding a worktree, inspect git worktree list, relevant worktree statuses, submodules, the target path, the intended commit or …

    line 126
  27. Distinctive:

    Remove a clean linked worktree with git worktree remove.

    line 137
  28. Very specific:

    Use lock for a worktree on storage that may be temporarily unavailable, prune for stale administrative records after a worktree is already …

    line 140
  29. Distinctive:

    If a secret may be staged, committed, reflog-reachable, or pushed, stop.

    line 147
  30. Very specific:

    Treat hooks and core.hooksPath as executable configuration.

    line 150
  31. Very specific:

    Never solve repository ownership warnings by setting safe.directory=*.

    line 152
  32. Very specific:

    Treat changed .gitmodules, submodule URLs, gitlinks, and pinned submodule commits as dependency provenance.

    line 154
  33. Distinctive:

    Follow established signing policy.

    line 156

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “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 Workflows

Use this skill for repository-state operations beyond constructing a new commit. Preserve unrelated work, inspect local policy before acting, and make the exact side effect explicit before running a mutating command.

Use git-commit to group, stage, validate, and describe new commits. Load security-review and security-review-evidence when secrets, credentialed remotes, signing trust, untrusted hooks or configuration, or other security boundaries are involved. Use dependency-supply-chain-review for submodule, downloaded hook tooling, vendored-source, or provenance questions.

Core Rules

  • Follow repository instructions, contributing docs, branch protections, hooks, signing rules, and established integration policy over generic advice.
  • Distinguish HEAD, the index, the working tree, local refs, remote-tracking refs, and remote refs. Do not describe reset, restore, and checkout as interchangeable.
  • Distinguish uncommitted work, local-only commits, shared commits, and published refs before rewriting or discarding anything.
  • Never infer authorization to push, force-push, delete refs, rewrite history, or discard files from a request to commit, update, merge, or fix code.
  • Preserve unrelated user changes. Do not hide them with an unrequested stash, temporary commit, branch switch, worktree removal, or cleanup command.
  • Prefer reversible operations, but do not promise recovery. Reflogs are local, expire, and do not restore arbitrary untracked files removed from disk.
  • Treat command output and remote URLs as potentially sensitive. Report sanitized refs and outcomes instead of credentials or private host details.

Workflow

  1. Inspect policy and repository state.
    • Read relevant repository instructions and contributing or release docs.
    • Check git --version before relying on version-sensitive commands.
    • Inspect status, current branch or detached HEAD, staged and unstaged changes, recent history, upstream configuration, and relevant worktrees.
    • Inspect remotes only when needed and do not print credential-bearing URLs.
    • In unfamiliar repositories, inspect effective hook and configuration sources before an operation that can execute hooks.
  2. Define the intended outcome.
    • Separate branch or path switching from content restoration.
    • Separate downloading remote state from integrating it: fetch updates remote-tracking information; pull fetches and then integrates.
    • Choose whether history should preserve topology, replay commits, produce a squashed result, create an inverse commit, or move a ref.
    • For diagnosis, decide whether the task needs history inspection, line provenance, or a reproducible good/bad search before choosing log, blame, or bisect. Do not use blame to assign personal fault.
    • Determine whether affected commits or refs are already shared or published.
  3. Protect current work.
    • Start from a clean state when the chosen operation requires it.
    • If work is present, stop and decide whether it belongs in a commit or an explicitly authorized stash. A separate worktree can isolate a different branch task, but it does not transfer staged, unstaged, or untracked changes from the current tree. Do not choose silently.
    • Check untracked and ignored files before restore, reset, clean, checkout, worktree removal, or submodule recursion. Reflog cannot recover all of them.
    • Check for submodules before adding, moving, or removing worktrees. Git's multiple-worktree support for submodules is incomplete; do not create multiple superproject checkouts when submodules are present.
    • When leaving detached HEAD, preserve wanted commits with an intentional branch or tag first.
  4. Choose the narrowest operation.
    • Prefer switch for branch changes and restore for path or index content on Git 2.23 or newer. Retain checkout awareness for older repositories and ambiguous branch/path syntax; use -- to disambiguate paths.
    • Follow repository policy when selecting merge, rebase, squash, or fast-forward-only integration. Do not impose a universal pull strategy.
    • Prefer revert for undoing published changes. Use reset or rebasing only when moving or rewriting refs is the intended and authorized result.
    • Use cherry-pick for selected commits, not as a default substitute for a repository's normal integration workflow.
    • Treat tags as published release identifiers when repository policy does. Do not silently replace a published tag.
    • Use bisect only with a reproducible test or observation, mark untestable commits as skipped, record the first bad commit as evidence rather than the root cause, and reset the bisect session when finished.
  5. Confirm risky side effects.
    • Require explicit authorization for worktree or index discard, destructive cleanup, history rewriting, branch or tag deletion, remote updates, and forced ref changes.
    • Preview the target ref, source commit, affected paths, and remote state before acting. Use dry-run behavior where the command supports it.
    • Never use plain --force as routine guidance. --force-with-lease is a guard, not coordination; forms that rely on remote-tracking refs can be undermined by background fetches. Prefer an explicit expected object ID for a separately authorized critical rewrite.
    • Do not bypass hooks with --no-verify merely to make an operation succeed.
  6. Handle stopped operations deliberately.
    • Identify whether merge, rebase, cherry-pick, or revert owns the current conflict state before choosing continue, abort, skip, or quit.
    • Resolve content and semantic conflicts, then run focused validation for the integrated result. Compilation alone may not detect an incorrect merge.
    • Do not use reset --hard as generic conflict cleanup. An abort may also be unable to reconstruct pre-existing uncommitted work.
  7. Verify and report.
    • Recheck status, diffs, recent history, branch/upstream state, tags, and worktrees relevant to the operation.
    • For remote changes, verify the intended remote ref instead of assuming a successful local command proves the server state.
    • Report the operation, affected refs or paths, validation, and remaining risks. Never expose secrets, credentialed URLs, private keys, or sensitive hook output.

Worktree Decision And Lifecycle

  • Use a linked worktree when genuine concurrent branch work or a separate clean checkout must proceed without disturbing a worktree that remains in use. Prefer the current worktree for ordinary edits on the current task and branch.
  • Existing dirty work remains in its original worktree. Transfer it only through a separate, explicitly chosen commit, patch, or authorized stash workflow.
  • Before adding a worktree, inspect git worktree list, relevant worktree statuses, submodules, the target path, the intended commit or branch, and whether that branch is already checked out. A branch is normally checked out in only one worktree.
  • Specify branch intent. Without a commit-ish or explicit -b, -B, or --detach, git worktree add <path> may create a branch named after the final path component. Disclose the new directory, branch or detached state, and linked-worktree metadata before creation.
  • Worktrees share repository objects and refs while keeping separate working files, HEAD, and indexes. A ref update in one worktree can affect what the others observe even though their uncommitted files remain separate.
  • Remove a clean linked worktree with git worktree remove; do not delete its directory as the normal cleanup path. Forced removal of an unclean, locked, or submodule-bearing worktree can discard work and requires explicit authorization.
  • Use lock for a worktree on storage that may be temporarily unavailable, prune for stale administrative records after a worktree is already missing, and repair for inconsistent metadata such as a manually moved worktree. Do not use them as interchangeable cleanup commands.

Security and Supply-Chain Escalation

  • If a secret may be staged, committed, reflog-reachable, or pushed, stop. Do not print it. Determine the exposure class, rotate or revoke first, and coordinate any history rewrite or remote cleanup through the security skills.
  • Treat hooks and core.hooksPath as executable configuration. Do not trust or run unfamiliar hooks, hook managers, or downloaded helpers without review.
  • Never solve repository ownership warnings by setting safe.directory=*. Scope any trust exception to a repository that policy intentionally trusts.
  • Treat changed .gitmodules, submodule URLs, gitlinks, and pinned submodule commits as dependency provenance. Sanitize credential-bearing URLs.
  • Follow established signing policy. Do not change key, trust, or signature configuration merely to complete a Git operation.

Detailed Operation Guidance

Load references/operation-matrix.md when the task needs command-specific selection, abort/recovery behavior, or upstream documentation links. Keep the core workflow above active for every operation.

Do Not Use For

  • Grouping a working tree into commits or writing commit messages; use git-commit.
  • Reviewing code, deciding whether a pull request should merge, or deciding whether a release should ship.
  • GitHub issue, pull-request, review, or repository-administration APIs.
  • Editor workspaces or generic orchestration across unrelated repositories.
  • Checked-in CI or automated release publication where Git is only one pipeline step; use ci-release-engineering.
  • Docker/OCI or Compose configuration; use container-engineering. Other deployment systems require their applicable platform or repository-specific guidance.

Handoff Checklist

  • Repository policy and Git version checked.
  • Current work, detached state, upstreams, remotes, and publication state scoped.
  • Exact side effect and authorization confirmed.
  • Unrelated changes and sensitive output preserved.
  • Conflict, abort, and recovery path understood before mutation.
  • Resulting refs, status, diffs, and relevant validation verified.
  • Commands, outcomes, limitations, and residual risk reported safely.

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.