Git Workflow — Branch and Push Safety
Use this skill for all git operations.
Creating a Branch
Always branch from fresh main:
git fetch origin
git checkout -b {type}/{issue}-{description} origin/main
Branch naming: {type}/{issue}-{description}
- Types:
feat,fix,docs,test,refactor,perf - Example:
fix/135-to-dto-model-validate
Before Pushing
- Verify not on main:
git branch --show-current - Run the
testingskill checklist (all checks must pass) - Stage specific files (avoid
git add .):git add {specific files} - Commit with clear message:
type: description (#issue)
Rebasing
When main has moved forward:
git fetch origin
git rebase origin/main
If conflicts occur:
- Check conflicting files:
git status - Read both versions, resolve by integrating your changes with the logic in main
git add {resolved files}git rebase --continue- Run full test suite after resolution
- If unsure — stop and ask the human
If detached HEAD after rebase:
git checkout -B {branch-name}
Pushing
- First push:
git push -u origin {branch-name} - After rebase:
git push --force-with-lease - Never use
git push --force(unless explicitly told to overwrite a destructive remote commit) - Never push to main directly
Pre-Push Verification
Before every push, confirm:
git diff --name-only origin/main # Only expected files changed
git log --oneline origin/main..HEAD # Only your commits
Safety Rules
- Never run
git pullon feature branches — usefetch+rebase - Never rebase shared branches others may have pulled
- Check
git statusbefore any checkout or rebase (clean working tree required) - If working tree is dirty: commit or
git stashfirst
Source: edsonesf/ATU-CSD-POKEDEX — distributed by TomeVault.