git-operations
Skill0 starsChanged 3 months agoMITView on GitHub
Do the actual git work: branch, stage, commit, rebase, resolve conflicts, and recover with reflog and reset. Use when resolving merge conflicts, complex rebases, or git history repairs.
- Reads credentials
- Deletes or force-pushes
- Commits and pushes
5 other projects use a version of this.
Adopted by
Most recently taken up by
- komluk/scaffoldingtheir own version, first seen Nov 7, 2026
- GoogleCloudPlatform/sciontheir own version, first seen Oct 13, 2026
- m16khb-org/issueopstheir own version, first seen Sep 24, 2026
- snui1s/losna-clitheir own version, first seen Aug 31, 2026
- arnabdeypolimi/claude_code_setuptheir own version, first seen May 5, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- GoogleCloudPlatform/scion★ 2.1ksame name
- komluk/scaffolding★ 16same name
- m16khb-org/issueops★ 6same name
- arnabdeypolimi/claude_code_setup★ 4same name
- snui1s/losna-cli★ 1same name
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.
In this repository134 other files it gives its agents.
- accessibility-engineerSkill
- accessibility-fixSkill
- ai-data-remediation-engineerSkill
- ai-engineerSkill
- ai-eval-suite-builderSkill
- android-developerSkill
- api-designSkill
- api-lifecycle-engineerSkill
- appsec-architectSkill
- audit-readinessSkill
- authenticationSkill
- autonomous-optimization-architectSkill
- backend-architectSkill
- backend-buildSkill
- blockchain-security-auditorSkill
- branching-strategySkill
- bug-explainerSkill
- changelog-writerSkill
- change-notesSkill
- ci-cd-pipeline-builderSkill
- ci-pipelinesSkill
- cloud-costSkill
- cloud-security-architectSkill
- cloud-securitySkill
- codebase-mapSkill
- codebase-onboarding-engineerSkill
- code-comment-writerSkill
- code-reviewerSkill
- code-reviewSkill
- code-translatorSkill
- commerce-platformSkill
- compliance-auditorSkill
- composioSkill
- cron-job-plannerSkill
- database-optimizerSkill
- database-schema-designerSkill
- databaseSkill
- data-engineerSkill
- data-pipeline-architectSkill
- data-pipelinesSkill
- debuggingSkill
- debugging-strategistSkill
- dependency-auditSkill
- dependency-upgrade-auditorSkill
- deployment-checklistSkill
- deploymentSkill
- developer-platformSkill
- devops-automatorSkill
- ecommerce-cms-architectSkill
- email-intelligence-engineerSkill
- embedded-firmware-engineerSkill
- environment-setup-guideSkill
- error-boundary-designerSkill
- error-handlingSkill
- evidence-collectorSkill
- filament-optimizerSkill
- finops-engineerSkill
- firmwareSkill
- frontend-buildSkill
- frontend-developerSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
4
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
- Distinctive: line 22
Use interactive staging (git add -p) to review and stage distinct chunks rather than running blind git add ..
- Distinctive: line 30
Never merge a branch with 14 "fix typo" or "WIP" commits into main.
- Very specific: line 41
Never rebase a public shared branch (e.g.
- Distinctive: line 51
Verify code compiles and passes unit tests before staging:
- Distinctive: line 103
Result: All 4 commits restored to a proper named branch with zero code loss in 60 seconds.
“Common” is measured: kept by at least 6 in 10 of the 4 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.
Files
git-operations
Core Philosophy
Git is not a magical black box where you type random commands found on StackOverflow hoping your branch fixes itself. Git is a content-addressable, immutable directed acyclic graph (DAG) of snapshot objects. Mastering Git operations means understanding object pointers, commits, trees, and the reflog—enabling you to resolve any merge conflict cleanly, rewrite messy commit history safely, and recover from accidental deletions with zero panic.
4-Step Professional Git Operations Discipline
Step 1: Atomic Branching & Clean Commit Craft
- The Principle of Atomic Commits:
- Each commit represents exactly one logical change that compiles cleanly and passes tests.
- Use interactive staging (
git add -p) to review and stage distinct chunks rather than running blindgit add ..
- Conventional Commit Standard:
- Format:
<type>(<scope>): <short imperative summary> - Types:
feat,fix,refactor,perf,test,docs,chore. - Rule: Imperative present tense ("add user validation", not "added" or "adds").
- Format:
Step 2: Interactive Rebasing & History Rewriting
- Squashing & Cleaning Feature Branches:
- Never merge a branch with 14 "fix typo" or "WIP" commits into main.
- Rebase interactively onto upstream main:
git fetch origin main git rebase -i origin/main - Rebase Commands:
pick: Use commit as-is.reword: Change commit message.squash/fixup: Meld commit into previous commit (fixupdiscards commit message).
- The Golden Rule of Rebasing:
- Never rebase a public shared branch (e.g.
mainorproduction). Only rebase local feature branches.
- Never rebase a public shared branch (e.g.
Step 3: Complex 3-Way Merge Conflict Resolution
- Enabling Modern Conflict Markers:
- Configure Git to show the common ancestor base in conflict diffs:
git config --global merge.conflictstyle zdiff3
- Configure Git to show the common ancestor base in conflict diffs:
- Systematic Conflict Resolution Protocol:
- Identify the 3 states:
<<<<<<< HEAD(your changes),||||||| base(original state before both branched),>>>>>>> incoming(their changes). - Verify code compiles and passes unit tests before staging:
git add <resolved-file> git rebase --continue - Abort cleanly if lost:
git rebase --abortorgit merge --abort.
- Identify the 3 states:
Step 4: Emergency Recovery with Git Reflog & Reset
- Recovering Lost Commits:
- Git almost never deletes committed objects immediately. The reference log (
reflog) records every movement ofHEAD. - View history of HEAD movements:
git reflog - Restore branch state to prior snapshot:
git reset --hard HEAD@{2}
- Git almost never deletes committed objects immediately. The reference log (
- Safely Undoing Mistakes:
- Undo last commit but keep changes staged:
git reset --soft HEAD~1. - Undo last commit and unstage changes:
git reset HEAD~1.
- Undo last commit but keep changes staged:
Deliverable Format: Git Runbook & Conflict Log (GIT-RUNBOOK.md)
# Git Incident Recovery & Rebase Runbook
## 1. Branch Health & Clean History Strategy
- **Target Branch**: `feature/auth-refactor` -> `main`
- **Rebase Base**: `origin/main` (latest commit `e4f1a09`)
- **Action Plan**: Interactive rebase squashing 8 WIP commits into 2 atomic commits.
## 2. Conflict Resolution Walkthrough
| File | Conflict Nature | Resolution Chosen | Verification |
|---|---|---|---|
| `src/auth.ts` | Overlapping imports | Combined both imports | `npm run build` passed |
| `prisma/schema.prisma` | Conflicting model fields | Kept both fields; reordered | `npx prisma validate` |
## 3. Disaster Recovery Plan (Reflog Snapshot)
- Pre-rebase HEAD: `HEAD@{1}: commit 7b2a9c1 "feat(auth): initial oauth scaffolding"`
- Emergency recovery command: `git reset --hard 7b2a9c1`Worked Example: Rescuing a Detached HEAD State
- Problem: Engineer accidentally checked out a commit hash directly, made 4 commits, and could not find them after switching back to
main. - Diagnosis: Ran
git reflog, identified the lost commit hasha81f3d2. - Remediation: Executed
git branch feature/recovered-work a81f3d2. - Result: All 4 commits restored to a proper named branch with zero code loss in 60 seconds.
Verification Checklist
- Feature branch rebased cleanly on latest
origin/mainprior to PR review. - Commits are squashed into atomic, logically distinct units with conventional commit messages.
merge.conflictstyle zdiff3configured to inspect common ancestor during conflicts.- All unit and integration tests pass cleanly after conflict resolution.
- Pre-rebase state noted from
reflogbefore executing destructive operations.
Anti-Patterns
- Force-Pushing Shared Branches: Running
git push --forceonmain, destroying teammates' commits. (Always use--force-with-lease). - Committing Secrets: Adding
.envfiles or API credentials into git tracking. - Giant Merge Dumps: Merging a 40-commit branch full of "wip", "fixed bug", "test" messages directly to main.
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
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.

