Skip to content

Git Workflows


  • main — always deployable (production)
  • dev — integration branch for ongoing work
  • feature/* — short-lived branches for new tasks
  • hotfix/* — urgent fixes from main (for “oh shit” fixes only)

Terminal window
git clone <github-url>

2. Create and Use the dev Branch (if dev branch already exists, skip to 3)

Section titled “2. Create and Use the dev Branch (if dev branch already exists, skip to 3)”
Terminal window
git switch -b dev
git push -u origin dev
Terminal window
git switch dev
git pull origin dev
git switch -b feature/your-task-name
Terminal window
git commit -m "Describe what you did"
git push -u origin feature/your-task-name
  • Merge into dev when reviewed and approved
Terminal window
git switch main
git pull origin main
git merge dev
git push origin main
Terminal window
git tag -a v1.0.0 -m "First release"
git push origin --tags
Terminal window
git checkout main
git pull origin main
git checkout -b hotfix/issue-name
# After fix:
git add .
git commit -m "Fix critical issue"
git push origin hotfix/issue-name
# PR to main, then merge into dev too

+------------------+
| main |
| (production) |
+--------+---------+
^
|
Merge to main when stable
|
+------v------+
| dev |
| (staging) |
+------+------+
^
|
+--------------+---------------+
| |
+---v------------------+ +-------v------------------+
| feature/your-feature | | hotfix/critical-issue |
| (off of dev) | | (off of main) |
+----------------------+ +--------------------------+
| |
PR to dev PR to main
and dev