agentleFS
VJDiPaolaVJDiPaola/skill-forge/git-workflows/SKILL.md

git-workflows

Skill0 starsChanged 30 days agoMITView on GitHub

Git beyond the basics: interactive rebase, bisect, history surgery, recovering lost work, and untangling messy branch states. Use when the user asks to clean up commits before a PR, find which commit broke something, undo a bad merge or rebase, split or combine commits, recover deleted work, or fix a detached HEAD. Trigger on rebase, bisect, cherry-pick, reflog, squash, amend, force push, or I messed up my branch.

  • Deletes or force-pushes
  • Commits and pushes

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    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. Very specific:

    After any rebase of a pushed branch: git push --force-with-lease (never bare --force.

    line 41

“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

History surgery, regression hunting, and recovery. Complements gh-fix-ci (which handles failing GitHub Actions checks).

Not in scope

Repo hosting administration (branch protection, permissions), monorepo tooling, git LFS setup, and CI configuration. Routine add/commit/push needs no skill.

First rule of recovery: almost nothing is lost

Committed work survives branch deletion, bad rebases, and hard resets for ~90 days. Before declaring data loss:

git reflog                    # every position HEAD has held
git reflog show <branch>      # every position a branch has held
git branch rescue <sha>       # pin the good state before doing anything else
git fsck --lost-found         # dangling commits not in any reflog

Uncommitted-but-staged work: git fsck --unreachable | grep blob can still find the blobs. Uncommitted, unstaged work is the one thing actually gone.

Before any destructive operation (reset --hard, rebase, filter-repo): git branch backup-$(date +%s) costs nothing and turns every mistake into a checkout.

Cleaning up a branch before a PR

Goal: commits that each build and tell one story.

git rebase -i $(git merge-base main HEAD)
  • squash/fixup the "wip", "typo", "address review" commits into their parent.
  • reword messages to say why, not what.
  • edit + git reset HEAD^ to split a commit doing two things; stage and commit in pieces (git add -p).
  • During ongoing review, prefer git commit --fixup <sha> then git rebase -i --autosquash at the end, so reviewers can see what changed between pushes.
  • After any rebase of a pushed branch: git push --force-with-lease (never bare --force; the lease aborts if someone else pushed).

Note: some agent environments can't run interactive rebase. The non-interactive equivalent for "squash everything since main into one commit": git reset --soft $(git merge-base main HEAD) && git commit.

Finding the commit that broke it

git bisect start
git bisect bad                # current state is broken
git bisect good v1.4          # last known good ref
# git checks out midpoints; test each and mark:
git bisect good|bad|skip
git bisect reset              # when done

Automate when the failure is scriptable: git bisect run npm test (or any command exiting 0 for good, non-zero for bad, 125 for skip). Bisect over ~1000 commits is ~10 tests; always prefer it over reading diffs.

Cheaper first checks: git log -S "someString" --oneline (when did this string appear/disappear), git log -L :funcName:path/file.js (history of one function), git blame -w -C path/file (ignore whitespace, follow moves).

Undoing things: pick the right tool

SituationCommand
Fix message/contents of last unpushed commitgit commit --amend
Unstage a filegit restore --staged <f>
Discard local edits to a filegit restore <f> (destructive)
Undo last commit, keep changes stagedgit reset --soft HEAD^
Undo a pushed commit safelygit revert <sha> (new inverse commit)
Undo a pushed mergegit revert -m 1 <merge-sha>
Rebase went wronggit rebase --abort, or after the fact git reset --hard <sha-from-reflog>
Committed to the wrong branchgit branch right-branch && git reset --hard origin/wrong-branch then switch
Need one commit from another branchgit cherry-pick <sha> (-x to record origin)

Rule: reset rewrites your branch (fine while unpushed), revert adds history (required once shared).

Untangling common messes

  • Detached HEAD with work on it: git branch save-me right there, then switch back.
  • Merge conflict panic: git merge --abort / git rebase --abort returns to the pre-attempt state; nothing is committed yet.
  • Accidentally committed a secret: rotating the secret comes first; then git filter-repo (not filter-branch) to purge history, force-push, and accept that forks/clones still have it.
  • Diverged from remote after someone force-pushed: git fetch then git reset --hard origin/<branch> (stash or branch local work first).
  • Huge accidental file blocking push: git rm --cached <file>, add to .gitignore, amend or rebase it out of the offending commits.

Download now (ZIP)

  • Other versions6 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Used alongsideProjects 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

    • 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

    • +7 more from TencentCloudBase
  • In this repository38 other files it gives its agents.

Does it work?

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

Reviews can't be read right now.

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.