git-expert
Skill4 starsChanged 6 months agoMITView on GitHub
Advanced Git operations including reflog recovery, bisecting, complex conflict resolution, and history manipulation. You MUST load this skill when performing advanced git operations or repository recovery.
- Deletes or force-pushes
- Commits and pushes
2 other projects use a version of this.
Adopted by
Most recently taken up by
- IncomeStreamSurfer/claude-git-experttheir own version, first seen Nov 8, 2026
- croustibat/vibe-synctheir own version, first seen Sep 22, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- IncomeStreamSurfer/claude-git-expert★ 4same name
- croustibat/vibe-sync★ 0same 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 repository124 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/AGENTS.mdAGENTS.md
- .github/workflows/AGENTS.mdAGENTS.md
- .vscode/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- agent-log-analysisSkill
- agent-mdSkill
- agent-md-writerSkill
- agent-skill-md-writerSkill
- agentskillsSkill
- agents-md-writerSkill
- ai-prompt-writerSkill
- ansibleSkill
- apache-airflow-apiSkill
- apache-airflow-dagsSkill
- astro-cliSkill
- astronomer-docsSkill
- awesome-copilotSkill
- brainstorm-agent-runsSkill
- brainstorm-github-prSkill
- brainstormSkill
- catSkill
- chrome-devtoolsSkill
- claude-docsSkill
- codeqlSkill
- code-reviewSkill
- code-tourSkill
- coding-standard-writerSkill
- context-aware-opsSkill
- copilot-cliSkill
- copilot-docsSkill
- critical-thinkingSkill
- datadog-agentSkill
- datadog-apiSkill
- datadog-mcpSkill
- datadog-monitorsSkill
- datadog-pulumiSkill
- devcontainerSkill
- dictationSkill
- direnvSkill
- dockerfileSkill
- dockerSkill
- docs-reviewSkill
- docs-writerSkill
- dot-claudeSkill
- dotfilesSkill
- dot-githubSkill
- editorconfigSkill
- fact-writerSkill
- gdpr-compliantSkill
- gh-agent-taskSkill
- gh-apiSkill
- gh-aw-compileSkill
- gh-aw-firewall-debugSkill
- gh-aw-firewallSkill
- gh-aw-newSkill
- gh-awSkill
- gh-aw-troubleshootingSkill
- gh-codespaceSkill
- gh-issueSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 10 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Commit history rewriting is required (e.g., squashing, reordering, editing).
- Distinctive: line 30
When a graphical Git client or GitHub's web UI provides a safer, more transparent way to resolve a simple conflict.
- Distinctive: line 31
If you lack a fundamental understanding of Git's object model (attempting expert commands without knowledge often destroys history).
- Distinctive: line 49
Objective: Use binary search to find the exact commit that introduced a bug.
- Distinctive: line 68
Diagnose: Run git fsck --full to identify missing/corrupted objects or refs.
- Very specific: line 71
Empty Objects: Delete zero-byte objects blocking pulls with find .git/objects/ -type f -empty -delete.
- Very specific: line 73
Bad Refs/Heads: Check for corrupted or duplicate branch refs (e.g., from cloud-sync like iCloud/Dropbox).
- Very specific: line 76
Finalize Repair: If local index/HEAD is corrupted, rm -rf .git/index and git reset --hard origin/<branch>.
- Distinctive: line 78
Detached HEAD: If work is committed in a detached head, immediately create a branch before checking out anything else: git branch …
- Distinctive: line 80
Untracked files overwriting: If a checkout/pull is blocked by untracked files, stash them (git stash push -u) or clean (git clean -fd - …
- Distinctive: line 82
Accidental Force Push: Look for previous commit SHA in local terminal history, local git reflog (if same machine), or GitHub PR/Issue …
- Distinctive: line 87
Always verify the workspace state with git status and history with git log --oneline --graph -n 15 after altering history.
- Distinctive: line 88
Ensure all automated actions gracefully handle conflicts by checking exit codes.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
<!-- markdownlint-disable MD013 MD023 MD031 MD032 -->Advanced Git Operations
Expert-level guidance for executing complex Git operations safely and effectively.
When to Use
- User has lost commits or needs to recover state using
git reflog. - User needs to find a regression using
git bisect. - User is managing Git submodules or advanced worktrees.
- Local repository corruption requires recovery (e.g., empty objects, bad object refs,
git fsckfailures). - Commit history rewriting is required (e.g., squashing, reordering, editing).
- User requires assistance with complex merge conflicts or tree manipulations.
Note: For specific guidance on Git rebase operations and interactive rebasing, see the git-rebase skill.
When Not to Use
- For standard, day-to-day operations like simple commits, pulls, or merges (use the base
gitskill). - When a graphical Git client or GitHub's web UI provides a safer, more transparent way to resolve a simple conflict.
- If you lack a fundamental understanding of Git's object model (attempting expert commands without knowledge often destroys history).
Common Pitfalls
- Panic Force-Pushing: Running
git push --forceimmediately after a bad rebase instead of calmly usinggit reflogto restore the previous state. - Detached HEAD Confusion: Committing work in a detached HEAD state and then checking out another branch, instantly losing track of the new commits.
- Corrupting the Index: Manually deleting files inside the
.git/directory to "fix" an error instead of using proper commands likegit fsckorgit reset.
Reflog Recovery (git reflog)
- Objective: Recover lost commits, branches, or undo a destructive operation (like a bad hard reset).
- Process:
- View history of HEAD movements:
git reflog - Identify the target commit SHA (e.g.,
HEAD@{2}). - Restore state:
git reset --hard <sha>or create a branch:git branch <branch-name> <sha>.
- View history of HEAD movements:
Bisecting (git bisect)
- Objective: Use binary search to find the exact commit that introduced a bug.
- Process:
- Start:
git bisect start - Mark broken commit (usually current):
git bisect bad - Mark known good commit:
git bisect good <good-commit-sha> - Git will checkout intermediate commits. Test, then mark
git bisect goodorgit bisect bad. - Conclude:
git bisect resetto return to the original branch.
- Start:
Advanced Cherry-Picking
- Objective: Apply specific commits from one branch to another without merging the whole branch.
- Process:
git cherry-pick <commit-sha> - Multiple commits:
git cherry-pick <sha-A>^..<sha-B> - No commit (stage only):
git cherry-pick -n <commit-sha>
Complex Troubleshooting
- Corrupted Repository Recovery: For errors like
fatal: bad object refs/heads/...,object file is empty, orgit did not send all necessary objects.- Diagnose: Run
git fsck --fullto identify missing/corrupted objects or refs. - Backup first: From the parent directory, back up the entire repository:
cp -a <repo-name> <repo-name>.bakbefore destructive commands. - Empty Objects: Delete zero-byte objects blocking pulls with
find .git/objects/ -type f -empty -delete. - Bad Refs/Heads: Check for corrupted or duplicate branch refs (e.g., from cloud-sync
like iCloud/Dropbox). Delete broken refs (e.g.,
rm .git/refs/heads/devorgit update-ref -d refs/heads/dev), thengit fetch -pto restore. - Finalize Repair: If local index/HEAD is corrupted,
rm -rf .git/indexandgit reset --hard origin/<branch>.
- Diagnose: Run
- Detached HEAD: If work is committed in a detached head, immediately create a branch
before checking out anything else:
git branch backup-branch. - Untracked files overwriting: If a checkout/pull is blocked by untracked files, stash
them (
git stash push -u) or clean (git clean -fd- destructive). - Accidental Force Push: Look for previous commit SHA in local terminal history, local
git reflog(if same machine), or GitHub PR/Issue events to restore.
Verification
- Always verify the workspace state with
git statusand history withgit log --oneline --graph -n 15after altering history. - Ensure all automated actions gracefully handle conflicts by checking exit codes.
Related Skills
- git-rebase: You MUST load this skill when performing Git rebase operations.
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.

