Git workflow recipes
Public collection of agent skills — reusable capabilities, prompts, and workflows for Claude Code and other agentic coding tools.
npx -y skills add Solonnikov/agent-skills --skill git-workflow-recipesAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Ready-to-use git recipes for the operations people actually run every day — undoing mistakes, safe rebasing, resolving conflicts, rescuing lost work, and PR-friendly history cleanup. Use when a user asks how to undo a git operation, clean up a branch before merging, recover from a bad push, or make a branch PR-ready.
SKILL.md
3.5 KB, as published. Nobody here has run it
Git Workflow Recipes
Recipes for the git operations that come up daily and are easy to get wrong. Not a git reference — a collection of "what do I type when X happens" answers with the safety rails intact.
When to use
- Someone asks "how do I undo the last commit / the last push /
git reset --hard". - A branch needs to be cleaned up (squash, rebase, reorder) before a PR merge.
- A merge or rebase has conflicts and the flow has stalled.
- A commit or branch was "lost" and needs recovery.
- You're about to run a destructive operation (
reset --hard,push --force,rebase -i) and want the least-destructive path.
Before you start
Know these:
- Is this shared or local? Rewriting history you've already pushed to a shared branch is a different conversation than rewriting unshared local history. The recipes flag which is which.
- Is the working tree clean? Most recovery recipes want a clean tree. Run
git statusfirst;git stashif needed. - Backup the branch before anything destructive.
git branch backup-<name>before a rebase or reset costs nothing and saves hours. reflogexists. Almost every "I lost it" can be recovered viagit reflog. Don't panic; check reflog first.
Workflow
- Identify the situation. Match it to a recipe in the references.
- If the recipe involves rewriting history, back up the branch first.
- Execute the recipe exactly — don't improvise on destructive commands.
- Verify with
git log,git status, and a quick diff against the expected state. - If it's a shared branch, communicate the force-push to anyone else tracking it.
Non-negotiable rules
- Never
git push --forcetomainor a shared branch. Use--force-with-leasefor your own feature branch only. On protectedmainbranches, force push is usually blocked server-side — good. - Never
git reset --hardwithout confirming there's nothing uncommitted. It's irreversible. Stash or commit first if in doubt. - Never rewrite history someone else has based work on. If a colleague has pulled your branch and built commits on top, rebasing it will leave them stranded.
git reflogis the safety net. Anything you accidentally "deleted" in the last ~90 days is recoverable unless you've also rungit gc --prune=now. Learn reflog before you learn the scary commands.- Commit before risky operations. Even a WIP commit gives you a reflog entry. An uncommitted change is the only truly lost state.
References
- Undo and recover — the
reset/revert/restore/reflogmatrix. The single most-asked set of recipes. - Rebase and merge — interactive rebase, conflict resolution, the rebase-vs-merge call,
--force-with-lease. - Staging and committing — partial adds, hunks, amending, splitting one commit into many, fixup + autosquash.
- Branching workflow — feature branches, naming, cleanup before PR, rescuing commits made on the wrong branch.
- History surgery —
cherry-pick,bisect,filter-repofor removing sensitive data, squashing a whole branch.