git-workflow
Everyday Git workflow: branch, commit, push, PR. Trunk-based default, atomic commits, force-with-lease only. Use for routine version-control work.
SKILL.mdskills/git/git-workflow/SKILL.md
GitHubgit-workflow
Keep main deployable; make small, reviewable, revertable history.
Inspection
Inspect branch state, remote tracking, and whether commits are shared before choosing merge/rebase/amend/force-push.
Decision rules
Private branch → rebase + force-with-lease; shared history → merge/revert only; messy tree → split into atomic commits before pushing.
Activate when
- Branching, committing, pushing, opening PRs, syncing with remote.
Do NOT activate for
- Conflict surgery (git-conflicts), lost-work recovery (git-recovery), history analysis (git-history-analysis), releases (git-release).
Procedure
- Diagnose state first:
git status,git log --oneline -5, ahead/behind vs upstream. Never act on a dirty or diverged tree blindly. - Branch: short-lived
feature/*off main (GitHub Flow default); trunk-based only with CI + flags; long-lived branches only for parallel supported versions. - Commit: atomic, conventional (
feat:,fix:,refactor:…), one logical change each; split messy trees before committing. - Push:
--force-with-leaseon your own pushed branch after rebase; never--forceon shared history. - Tool gates: IF
ghexists, use it for PR create/status; ELSE use the hosting UI. IF worktrees fit parallel streams, one branch per worktree. - Verify:
git statusclean-or-intentional, CI green, PR linked to issue.
Failure modes
Force-push without lease; pushing a dirty/diverged tree blind; stacking unrelated work on one branch; rebasing branches others build on.
Escalation
Lost work → git/git-recovery; PR process → github/pr-workflow.