agentleFS
kwhornekwhorne/elyra-skills/skills/git-workflow/SKILL.md

git-workflow

Skill1 starsChanged 6 months agoMITView on GitHub

Work git like a professional - branching discipline, rebase vs merge, history hygiene, interactive rebase, bisect, and recovering from mistakes with reflog. Use when the user asks about branching strategy, fixing a messy history, undoing a git mistake, resolving conflicts, splitting commits, or any non-trivial git operation.

  • Deletes or force-pushes
  • Commits and pushes

118 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use squad-commands, typescript-patterns and 9 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.
  • MicrosoftSkill

    squad-commands

    Categorized catalog of common Squad operations. Coordinator reads this file and presents it as an interactive menu when the user asks for available commands or help.

    Also in 3 projects that use this

  • cohen-lielSkill

    typescript-patterns

    TypeScript best practices and patterns. Use when writing TypeScript code, defining types, working with generics, or converting JavaScript to TypeScript.

    Also in 4 projects that use this

  • martinholovskySkill

    llm-integration

    Expert skill for integrating local Large Language Models using llama.cpp and Ollama. Covers secure model loading, inference optimization, prompt handling, and protection against LLM-specific vulnerabilities including prompt injection, model theft, and denial of service attacks.

    Also in 4 projects that use this

  • YepAPISkill

    background-jobs

    Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

    Also in 3 projects that use this

  • Vimalk0703Skill

    dependency-management

    Vet packages before adoption, audit for vulnerabilities, pin versions, and prevent dependency bloat.

    Also in 3 projects that use this

  • pluginagentmarketplaceSkill

    microservices

    Microservices architecture patterns and best practices. Service decomposition, inter-service communication, and distributed data management.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 101 edited versions we read keep these.

  • 3

    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
  1. Distinctive:

    Keep current with main via git rebase main (own branch) — resolves conflicts while they're small

    line 35
  2. Distinctive:

    Read both sides before choosing.

    line 64
  3. Very specific:

    After resolving: build + run tests *before* --continue

    line 65
  4. Distinctive:

    When advising on or performing git surgery, report:

    line 70

“Common” is measured: kept by at least 6 in 10 of the 101 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 Workflow

History is a tool, not a diary. Optimize it for the future reader — the reviewer today and the person running git bisect in two years.

When to use

  • "How should we branch for this?" / "rebase or merge?"
  • "I committed to the wrong branch / pushed a secret / lost my changes"
  • Cleaning up a PR's history before review
  • Conflicts, cherry-picks, splitting or reordering commits

Principles

  • Small branches, short lives. A branch older than a few days is a merge conflict farm. Integrate often.
  • Each commit compiles and passes tests. That's what makes git bisect work and reverts surgical.
  • Rewrite local history freely, shared history never. Rebase your own unpushed work; once others build on it, it's immutable.
  • Almost nothing is lost. Committed work is recoverable via reflog for ~90 days. Don't panic; don't rm -rf and re-clone.

Branching discipline

  • Branch from up-to-date main; name by intent: feat/..., fix/..., chore/...
  • One branch = one reviewable concern. Two features = two branches
  • Keep current with main via git rebase main (own branch) — resolves conflicts while they're small
  • Rebase vs merge rule of thumb: rebase your private branch onto main; merge (or squash-merge) the branch into main per the team's convention. Never rebase a branch others have pulled

History hygiene (before review)

git rebase -i main          # squash fixups, reorder, reword
git commit --fixup <sha>    # mark a fix for an earlier commit…
git rebase -i --autosquash main   # …then fold it in automatically
git add -p                  # stage hunks selectively → atomic commits

Target: each commit is one logical change with a message explaining why (see conventional-commits).

Recovery cookbook

SituationFix
Committed on wrong branchgit checkout right-branch && git cherry-pick <sha>, then remove from wrong branch
Undo last commit, keep changesgit reset --soft HEAD~1
Undo a pushed commitgit revert <sha> — never reset shared history
"I lost my work"git reflog → find the sha → git checkout -b rescue <sha>
Messed-up rebase/merge in progressgit rebase --abort / git merge --abort
Secret pushedRotate the secret first (history rewrite alone never un-leaks it), then scrub with git filter-repo
Find the commit that broke Xgit bisect start && git bisect bad && git bisect good <sha> (automate: git bisect run <test-cmd>)

Conflict resolution

  • Resolve conflicts per commit during rebase — smaller, with context
  • Read both sides before choosing; "take mine" without reading is how regressions ship
  • After resolving: build + run tests before --continue
  • Recurring conflicts in lockfiles/generated files → regenerate instead of hand-merging

Output format

When advising on or performing git surgery, report:

## Git: <operation>

**Situation:** what state the repo was in.
**Plan:** commands, in order, with one-line why each.
**Safety:** what's backed up (branch/sha) before destructive steps.
**Result:** end state + how to verify (`git log --oneline -5`, tests).

Anti-patterns

  • ❌ git push --force to a shared branch (--force-with-lease on your own, after rebase, is fine)
  • ❌ Commits named "wip", "fix", "fix2", "final" reaching main
  • ❌ Long-lived feature branches integrating monthly
  • ❌ Resolving a rebase conflict by mass-accepting one side
  • ❌ Re-cloning the repo because the working tree "feels broken" — diagnose with status/reflog first
  • ❌ Rewriting pushed history to hide a leaked secret instead of rotating it

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.