Imported from digitalsolutionsshahid-sys/riverdale-pharmacy (
.agents/skills/git-version-control/SKILL.md). Install upstream withnpx skills add digitalsolutionsshahid-sys/riverdale-pharmacy --skill git-version-control. Copyright stays with the author.
Git & Version Control Skill
Operational runbook for clean version control, atomic commits, branch hygiene, and safe rollbacks.
1. Conventional Commits Standard
Format: <type>(<optional-scope>): <description>
Common Types:
feat: New feature or page (e.g.,feat(hero): add emergency hours callout and click-to-call CTA)fix: Bug fix (e.g.,fix(a11y): correct contrast ratio on secondary button text)perf: Performance improvement (e.g.,perf(images): add priority and avif format to hero banner)style: Visual styling, design token adjustments without logic changesrefactor: Code change that neither fixes a bug nor adds a featuredocs: Documentation or README updateschore: Build config, dependencies, or tool settings (chore(tailwind): add brand color palette)
Rules:
- Write in the imperative mood ("add", "fix", "update", not "added" or "adds").
- Keep subject line under 72 characters.
- Explain "why" in the commit body if a decision is non-obvious.
2. Atomic Commits Discipline
- Every commit should represent a single logical unit of work.
- Do not mix dependency upgrades, style changes, and feature code in a single commit.
- Before committing, verify the staged diff:
git diff --staged
3. Rollback & Recovery Runbook
- Safe Rollback of a Published Commit:
Create a new commit that inverts the changes without rewriting history:
git revert <commit-hash> - Discard Uncommitted Local Changes:
- Discard all modified files in working tree:
git restore . - Unstage a file without losing edits:
git restore --staged <file-path>
- Discard all modified files in working tree:
- Review Commit History:
git log --oneline -n 10 - Emergency Recovery (Undo accidental reset):
git reflog git checkout <reflog-hash>
4. Pre-Deployment Cleanliness
- Ensure
.gitignoreincludes:node_modules/ .next/ out/ .env*.local .DS_Store *.log - Verify
git statusshows no stray artifacts or uncommitted secrets before building or deploying.