GenerativeModels.ai
Git Workflow Diagram

Git Workflow


This document outlines how we manage Git at GenerativeModels.ai to ensure consistency, reliability, and speed across our development process.


🌳 Branching Strategy

BranchPurpose
mainAlways stable. Deployed to staging after each merge.
feature/*For new features or bugfixes. Branched from main.
release/*Used to prepare a production release. Branched from main.
hotfix/*Urgent fixes for production. Branched from main or releases.

πŸ” Workflow Overview

Git Workflow Diagram

1. Start a Feature

  • Branch from main:

    git checkout main
    git pull
    git checkout -b feature/<short-name>
    
  • Examples:

    • feature/eval-dashboard
    • feature/embed-pipeline
    • bugfix/null-user-error

2. Create a Pull Request (PR)

  • Open a PR from feature/* to main
  • Ensure:
    • βœ… Code review is done
    • βœ… Tests and linter pass via CI

Once merged, main is deployed to staging for QA and validation.


3. Create a Release Branch

When staging is ready for production:

git checkout main
git pull
git checkout -b release/v1.3.0
  • Used to:
    • Run final production checks
    • Apply release-specific tweaks
    • Update changelogs and versioning

4. Production Release

When release/* is finalized:

  • Merge release/* β†’ main

  • Tag the release:

    git tag v1.3.0
    git push origin v1.3.0
    
  • Deploy main to production


5. Cherry-Pick Release Fixes to Main

If you make any commits directly on the release branch, cherry-pick them back to main to prevent divergence:

git checkout main
git cherry-pick <commit-sha>
git push origin main

6. Hotfix Workflow

For urgent production bugs:

git checkout main
git pull
git checkout -b hotfix/fix-payment-crash
# fix, commit, push

Then:

  • Merge into main
  • Tag + deploy
  • Optionally cherry-pick into current release if still active

7. Clean Up

After merging any branch:

git branch -d feature/<n>
git push origin --delete feature/<n>

βœ… Best Practices

  • Always branch from latest main
  • Keep feature branches short-lived
  • Keep PRs small and focused
  • Use CI, linters, and review before merging
  • Tag every production release (e.g. v1.3.0)
  • Don’t forget to cherry-pick changes made in release branches back to main