Practical Git & GitHub Setup for Real-World Projects
A lot of Git & GitHub guides look perfect on paper — but fail in real life. Either they're too complex (enterprise-level GitFlow) or too basic ("just push to main"). This guide focuses on a clean, realistic, and production-ready setup that actually works for solo developers and small teams alike.
Why This Setup Works
- Easy for beginners to adopt immediately
- Scales naturally as your team grows
- Minimal rules, maximum clarity
- Used in real production projects
1. Branching Strategy
main → production-ready code
develop → active development
feature/* → new features
bugfix/* → bug fixes
hotfix/* → urgent production fixes
Examples:
feature/user-login
bugfix/cart-total
hotfix/payment-crash
Why not complex GitFlow? Fewer branches means faster onboarding, less confusion, and easier day-to-day maintenance without sacrificing structure.
2. Commit Message Convention
Use a lightweight conventional format:
type(scope): short description
| Type | Use for |
|---|---|
feat |
New feature |
fix |
Bug fix |
refactor |
Internal improvement |
docs |
Documentation |
test |
Tests |
chore |
Tooling / config |
Examples:
feat(auth): add OTP login
fix(cart): correct total price
refactor(api): simplify serializer
3. GitHub Labels
Keep your label system minimal and purposeful across four dimensions:
Type: type: bug · type: feature · type: enhancement · type: refactor
Priority: priority: high · priority: medium · priority: low
Status: status: ready · status: in-progress · status: blocked · status: needs-review
Severity (bugs only): severity: critical · severity: major · severity: minor
4. Issue Templates
Bug Report
## Description
## Steps to Reproduce
## Expected Behavior
## Actual Behavior
## Environment
Feature Request
## Problem
## Proposed Solution
## Alternatives
## Additional Context
5. Pull Request Template
## What does this PR do?
## Related Issue
Closes #123
## Changes Made
## How to Test
## Checklist
- [ ] Code follows standards
- [ ] Tests added/updated
- [ ] No breaking changes
6. Code Review & Branch Protection
Enforce these rules on main:
- No direct pushes — PRs required
- At least 1 approval before merge
- Status checks (CI) must pass
This ensures quality without slowing development down.
7. Automation with GitHub Actions
Create .github/workflows/ci.yml:
name: CI
on:
pull_request:
push:
branches: [main, develop]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test
This gives you: automatic PR failure when tests break, no human gatekeeping for test runs, and a consistently clean main branch.
8. Setup by Team Size
Solo Developer
- Branches:
main+feature/* - Labels: type + priority
- PRs: optional but recommended
- CI: non-negotiable
Even solo developers forget context. A clean history is a gift to your future self.
Small Team (2–5 Developers)
- Full branching strategy
- Mandatory PRs with 1 required approval
- Labels for status and severity
- CI required before merge
Larger Teams
- Add
CODEOWNERSfor code ownership - Require 2 approvals on critical paths
- Add lint and security checks to CI
- Automate release notes from commit history
9. README Structure
Every project should have a README that covers:
# Project Name
## Description
## Tech Stack
## Setup
## Scripts
## Contributing
## License
10. Common Mistakes to Avoid
- Too many labels — if nobody uses them, they're noise
- Direct commits to main — always branch, always PR
-
Vague commit messages —
fix stuffhelps nobody - No automation — manual processes get skipped under pressure
- No PR template — reviews become inconsistent and slow
Final Thoughts
A good Git & GitHub setup should disappear into the background and let you focus on building. Start with the basics, add automation early, and scale the process only when your team actually needs it.
The best workflow is the one your team actually follows.
Top comments (0)