ChatGPT Git Workflow & Version Control Guide Prompt

You are a senior engineering lead who has defined Git workflows for teams from 2 to 200 developers.

Category
💻 Coding
Difficulty
Intermediate
Models
3
Last Updated
2026-06-28
💻 Coding Intermediate git version control branching pull requests
Works with
📋 Prompt
You are a senior engineering lead who has defined Git workflows for teams from 2 to 200 developers.

Team: [team size — solo/2–5/5–20/20+]
Project: [project type — web app/library/monorepo/open source]
Problem: [current git problem — messy history/merge conflicts/unclear branching/slow releases]
Deployment: [deployment frequency — multiple per day/weekly/per sprint]

Task: Design a complete Git workflow:

1. BRANCHING STRATEGY: Which model (GitFlow/GitHub Flow/Trunk-based) and why for your team
2. BRANCH NAMING CONVENTION: Exact naming pattern with examples
3. COMMIT MESSAGE STANDARD: Format + examples (good and bad)
4. PULL REQUEST TEMPLATE: What every PR must include
5. MERGE STRATEGY: Merge vs. Squash vs. Rebase — which and when
6. COMMON COMMANDS: 10 git commands your team should know with examples
7. WORST MISTAKES: Top 5 git disasters and how to prevent/recover from each
GIT WORKFLOW: 5-person web app team, weekly deployments

BRANCHING STRATEGY: GitHub Flow (simplified)
Why: GitFlow is overkill for teams under 20. Trunk-based needs mature CI/CD. GitHub Flow matches your weekly release cadence and team size perfectly.

RULES:
• main = always deployable
• Every change = feature branch from main → PR → review → merge to main
• Deploy from main on a schedule or when ready

BRANCH NAMING:
feat/[ticket]-[short-description] → feat/TN-142-add-prompt-search
bug/[ticket]-[short-description] → bug/TN-198-fix-copy-button-mobile
hotfix/[description] → hotfix/security-patch-api-auth
chore/[description] → chore/update-dependencies-june

COMMIT MESSAGE FORMAT (Conventional Commits):
type(scope): short description (under 72 chars)

Good: feat(prompts): add variable fill-in UI to prompt detail page
Good: fix(auth): prevent token expiry on page refresh
Bad: 'fixed stuff'
Bad: 'WIP'
Bad: 'update'

Types: feat | fix | docs | style | refactor | test | chore

PR TEMPLATE:
## What does this PR do?
[1–2 sentence summary]
## Why?
[Link to ticket/issue]
## Testing
[ ] Unit tests pass
[ ] Tested on mobile
[ ] No console errors
## Screenshots (if UI change)

MERGE STRATEGY: Squash merge to main
Why: Keeps main history clean (one commit per feature), while preserving full history in the feature branch while it's open.

TOP 5 GIT DISASTERS:
1. Pushed secrets to public repo
Prevention: git-secrets pre-commit hook + .gitignore for .env
Recovery: Rotate credentials IMMEDIATELY (assume compromised), then git filter-branch or BFG Repo Cleaner

2. Force-pushed main and lost commits
Prevention: Branch protection rules on main (required reviews, no force push)
Recovery: git reflog — your commits exist in reflog for 90 days
🏆
Best model for this prompt
Claude
Claude (Opus 4 / Sonnet 4)
💡 Pro Tips
Branch protection rules on main are non-negotiable — require at least 1 review, disable direct pushes
Write commit messages as if the future you has no context — 'fix bug' is useless; 'fix login redirect loop when session expires' is useful
Squash merge for features keeps history clean; preserve full history only when you need it for debugging
`git stash` before switching branches — uncommitted work on the wrong branch causes most beginner git panics
⚠️ Common Mistakes
Committing directly to main — even for solo projects, PRs catch errors and create a paper trail
Enormous commits ('added everything') — small atomic commits make code review easier and bugs easier to isolate
Not using .gitignore from project start — adding it later when node_modules is already tracked is painful
Merge conflicts that grow for weeks — merge main into your branch at least every 2–3 days to minimise conflict surface area
❓ FAQ 🔗 Related Prompts