git-master

Enforces atomic commits, safe rebase surgery, and clean git history practices.

Updated Jul 31, 2024
One-click install
npx skills add https://github.com/sharosoo/dotfile --skill git-master-sharosoo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: git-master
Source: https://github.com/sharosoo/dotfile/tree/main/omp/omo-layer/skills/git-master
Command: npx skills add https://github.com/sharosoo/dotfile --skill git-master-sharosoo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Messy commit histories, accidental force-pushes on shared branches, and lost work after botched rebases are common git pain points. This Skill provides disciplined guidance for committing, branching, rebasing, and recovering repository state safely. ## Core Features & Use Cases - Atomic Commit Discipline: Enforces one logical change per commit with imperative-mood messages that explain why, not just what. - Safe History Surgery: Provides verified patterns for reset, amend, reflog recovery, and commit splitting without losing work. - Force-Push Risk Communication: Requires stating the blast radius before rewriting shared history with --force-with-lease. - Use Case: You just made a commit that mixes two unrelated changes. Invoke this Skill to split it with git reset HEAD~1, then stage and commit each logical chunk separately with clear messages. ## Quick Start Ask the assistant to review your staged changes and help you split them into atomic commits with proper messages before pushing.

Frequently Asked Questions about git-master

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

FAQPage Schema
How do I split a git commit into smaller commits?▼

Run git reset HEAD~1 to undo the commit while keeping changes unstaged, then stage and commit each logical chunk separately. Using git add -p lets you stage partial changes interactively for truly atomic commits.

How do I undo a git commit without losing changes?▼

Use git reset --soft HEAD~1 to undo the commit while keeping all changes staged. If you want to discard the changes entirely, use git reset --hard HEAD~1, but only when you are certain.

How do I recover a lost commit after a rebase or reset?▼

Use git reflog to find the dropped commit's hash, which remains available for roughly 90 days. You can then cherry-pick or reset to that hash to restore the work.

Is it safe to force-push after rebasing a shared branch?▼

Force-pushing rewrites shared history and can break collaborators' work. Always state what will move and who it affects first, and use --force-with-lease instead of --force to avoid overwriting others' commits.

Should I amend a commit or add a fix commit?▼

Amend the previous commit rather than adding a separate fix commit, keeping history clean and reviewable. Amend only commits that have not been pushed to a shared branch.