git-workflow

Manages local Git branches, worktrees, commits, merges, conflicts, and history recovery.

22|Updated Sep 10, 2026
One-click install
npx skills add https://github.com/Lynricsy/HyperSkills --skill git-workflow-lynricsy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-workflow
Source: https://github.com/Lynricsy/HyperSkills/tree/main/skills/git-workflow
Command: npx skills add https://github.com/Lynricsy/HyperSkills --skill git-workflow-lynricsy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Local Git work goes wrong in expensive ways: force-pushes that silently overwrite colleagues' commits, conflict resolutions that delete one side's work, rewrites that lose history, and 'lost' commits that are actually recoverable. This Skill encodes the verified mechanics and guardrails for every destructive or confusing Git operation so an agent commits, integrates, and recovers work without destroying it. ## Core Features & Use Cases - Safe history rewriting: Backup refs, git range-diff verification, --force-with-lease --force-if-includes pushes, and explicit collaborator instructions for any rewrite of published history. - Conflict resolution by intent: Enumerate every unmerged path, read both sides' history via MERGE_HEAD/REBASE_HEAD, handle ours/theirs inversion during rebase, and defuse rerere's markerless replayed resolutions. - Worktrees and parallel agents: One branch and worktree per task, bootstrap missing untracked files, avoid the shared refs/stash trap, and clean up with git worktree remove before branch deletion. - Recovery and archaeology: Reflog-first recovery of lost commits, git fsck --no-reflogs fallback, git bisect run exit-code contract, and git cherry to detect squash-merged branches. - Use Case: An agent asked to tidy a branch before review backs up the tip, folds fixups with git rebase --autosquash, verifies with range-diff, and force-pushes safely with a stated plan. ## Quick Start Use the git-workflow skill to rebase my feature branch onto the latest main, resolve any conflicts, and push it safely.

Frequently Asked Questions about git-workflow

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely force-push after rebasing a branch?

Use `git push --force-with-lease --force-if-includes` instead of plain `--force`. The lease alone is disarmed by any `git fetch`, so `--force-if-includes` (git 2.30+) additionally requires your pushed history to contain the remote-tracking tip. Take a backup branch first and verify with `git range-diff`.

How do I resolve Git merge conflicts correctly?

Enumerate every unmerged path with `git diff --name-only --diff-filter=U`, then read both sides' history via the operation's ref (MERGE_HEAD, REBASE_HEAD) before editing. Compose both intents where compatible, never use `-X ours` as a shortcut, and run the project's checks before committing.

Why did my conflicted file have no conflict markers but still show as unmerged?

That is `rerere` replaying a previously recorded resolution into the worktree while the index still marks the path unmerged. Inspect it with `git rerere diff` before committing; `git rerere forget <path>` clears the cache but only `git checkout --merge <path>` restores the markers.

Can I recover a commit lost after git reset --hard?

Yes, start at the reflog: `git reflog --date=iso` in the worktree where the work happened, then anchor it with `git branch recover/<slug> <sha>`. `git gc --prune=now` does not delete objects a reflog still references; only `reflog expire` plus `gc` destroys them. Uncommitted work, however, is unrecoverable.

Does git stash work safely across multiple worktrees?

No. `refs/stash` is shared across every worktree of a repository, so parallel agents will pop each other's stash entries. Only HEAD, the index, the working tree, in-progress operation state, and the per-worktree reflog are isolated; commit instead of stashing in parallel setups.

When should I use rebase versus merge?

Rebase only your own unpublished topic branch; merge anything others have checked out or built from, since a rebase hands collaborators a history without their commits. Merge also wins when one conflict would otherwise replay through every commit of the series.