Bayat Git Flow is a comprehensive branching strategy designed to accommodate a wide variety of project types within Bayat, from game development (Unity-based and cross-platform) to web applications, mobile apps, desktop applications, and libraries/packages. This document outlines the complete workflow, conventions, and best practices to be followed across all Bayat teams.
- Consistency - Maintain uniform practices across different project types
- Flexibility - Adapt to specific project needs without compromising the core workflow
- Traceability - Ensure all changes can be tracked and understood
- Stability - Protect production/release branches while enabling rapid development
- Efficiency - Minimize merge conflicts and enable parallel development
Every repository must maintain these primary branches:
main
- Production-ready code; always deployabledevelop
- Integration branch for features; represents the next releaserelease/*
- Preparation branches for upcoming releaseshotfix/*
- Emergency fixes for production issues
These branches are created as needed:
feature/*
- New features or enhancementsbugfix/*
- Non-critical bug fixes targeted for the next releaserefactor/*
- Code improvements without changing functionalitydocs/*
- Documentation updates onlyexperiment/*
- Experimental features (may never be merged)platform/*
- Platform-specific implementations (for cross-platform projects)
All branch names must follow these conventions:
- Use lowercase for all branch names
- Use hyphens to separate words
- Include ticket/issue numbers when applicable
- Be descriptive but concise
Examples:
feature/user-authentication
feature/JIRA-123-inventory-system
bugfix/login-validation-error
hotfix/2.1.1-payment-gateway-crash
release/3.0.0
platform/ios-native-controls
-
Branch Creation:
- Always branch from
develop
- Command:
git checkout develop && git pull && git checkout -b feature/feature-name
- Always branch from
-
During Development:
- Commit frequently with descriptive messages
- Keep feature branches synchronized with
develop
by regularly rebasing or merging fromdevelop
- Command:
git checkout develop && git pull && git checkout feature/feature-name && git rebase develop
-
Completion:
- Ensure all tests pass locally
- Submit a Pull Request (PR) to
develop
- Address all code review comments
- Once approved, merge using the squash and merge strategy
-
Branch Creation:
- Create a release branch from
develop
when ready to prepare a release - Use semantic versioning for branch naming
- Command:
git checkout develop && git pull && git checkout -b release/x.y.z
- Create a release branch from
-
Release Preparation:
- Only bug fixes, documentation, and release-oriented changes are permitted
- No new features should be added to release branches
- Version numbers and build configurations should be updated
- Comprehensive testing should be performed
-
Completion:
-
Merge the release branch into
main
with a regular merge (no squash) -
Tag the merge commit in
main
with the version number -
Merge the release branch back into
develop
-
Command sequence:
git checkout main && git pull git merge --no-ff release/x.y.z git tag -a vx.y.z -m "Version x.y.z" git push origin main --tags git checkout develop && git pull git merge --no-ff release/x.y.z git push origin develop
-
-
Branch Creation:
- Create hotfix branches directly from
main
- Command:
git checkout main && git pull && git checkout -b hotfix/x.y.z-issue-description
- Create hotfix branches directly from
-
During Hotfix:
- Keep changes minimal and focused on fixing the critical issue
- Ensure thorough testing even with the expedited timeline
-
Completion:
- Merge into
main
with a regular merge (no squash) - Tag the merge commit with the incremented version number
- Merge back into
develop
- Command sequence (similar to release completion)
- Merge into
All commit messages must follow this format:
<type>(<scope>): <subject>
<body>
<footer>
Where:
- Type: feat (feature), fix (bugfix), docs (documentation), style (formatting), refactor, test, chore
- Scope: Optional component/module name affected
- Subject: Brief description in imperative mood, not capitalized, no period at end
- Body: Detailed explanation of changes (optional)
- Footer: Reference issues, PRs, breaking changes (optional)
Examples:
feat(auth): add two-factor authentication option
Implement TOTP-based two-factor authentication with QR code setup
and recovery codes generation.
Resolves: #123
fix(ui): correct button alignment on checkout page
For comprehensive guidelines on commit messages, including detailed descriptions of each commit type, scope conventions, and project-specific examples, refer to the \1\2).
- Title: Clear and descriptive, including ticket reference
- Description:
- What changes were made
- Why these changes were necessary
- How the changes address the issue
- Any testing considerations
- Screenshots/videos for UI changes
- Size: Keep PRs small and focused on a single issue/feature
- Required Reviewers: At least one senior developer must approve
- Review Criteria:
- Code quality and style compliance
- Adequate test coverage
- Performance considerations
- Security implications
- Documentation updates
- Merge Requirements:
- All discussions resolved
- CI tests passing
- Required approvals received
-
Asset Management:
- Use Git LFS for binary assets
- Consider
.gitattributes
for platform-specific line endings - Exclude auto-generated files from Unity
-
Scene Management:
- Prefer prefabs over direct scene modifications
- Consider using Unity's ScriptableObjects for shared data
-
Platform-Specific Code:
- Use
platform/*
branches for platform-specific implementations - Merge platform branches into feature branches before PR to develop
- Use
-
Database Migrations:
- Include migrations in the same PR as related code changes
- Test migrations in both directions (up and down)
-
API Versioning:
- Use explicit API versioning in routes
- Document breaking changes in commit messages and PR descriptions
-
Feature Flags:
- Use feature flags for features that might need to be toggled after release
- Consider remote configuration for dynamically enabling/disabling features
-
App Store Requirements:
- Tag releases with both semantic version and build/store version
-
Public API Changes:
- Document all public API changes thoroughly
- Use deprecation notices before removing functionality
- Follow semantic versioning strictly
-
Dependency Management:
- Avoid introducing breaking changes in minor or patch versions
- Document all new dependencies in PR descriptions
-
Feature Branches:
- Run unit tests, linting, static analysis
- Generate test coverage reports
- Build but don't deploy
-
Develop Branch:
- All feature branch checks
- Integration tests
- Deploy to development/staging environment
-
Release Branches:
- Full test suite including performance tests
- Deploy to pre-production/QA environment
-
Main Branch:
- Minimal verification tests
- Deploy to production with approval step
-
Required for All Projects:
- Linting
- Unit tests
- Build verification
-
Project-Specific Checks:
- Unity: Asset validation, build for target platforms
- Web: Accessibility tests, browser compatibility tests
- Mobile: Platform-specific validations
All projects should follow semantic versioning (MAJOR.MINOR.PATCH):
- MAJOR: Breaking/incompatible API changes
- MINOR: Backward-compatible functionality additions
- PATCH: Backward-compatible bug fixes
-
Feature Releases:
- Increment MINOR version
- Reset PATCH version to 0
-
Bug Fix Releases:
- Increment PATCH version only
-
Breaking Changes:
- Increment MAJOR version
- Reset MINOR and PATCH versions to 0
# Clone repository
git clone https://github.com/bayat/project-name.git
cd project-name
# Set up Git LFS (for projects with binary assets)
git lfs install
# Start a new feature
git checkout develop
git pull
git checkout -b feature/feature-name
# Regularly sync with develop
git checkout develop
git pull
git checkout feature/feature-name
git rebase develop
# Push feature branch for the first time
git push -u origin feature/feature-name
# Subsequent pushes
git push
# Create a release branch
git checkout develop
git pull
git checkout -b release/x.y.z
git push -u origin release/x.y.z
# Finalize release
git checkout main
git pull
git merge --no-ff release/x.y.z
git tag -a vx.y.z -m "Version x.y.z"
git push origin main --tags
git checkout develop
git pull
git merge --no-ff release/x.y.z
git push origin develop
git branch -d release/x.y.z
git push origin --delete release/x.y.z
-
Prevention:
- Keep feature branches short-lived
- Regularly sync with
develop
- Communicate with team about overlapping work
-
Resolution Approach:
- Prefer resolving conflicts locally before pushing
- Use visual merge tools for complex conflicts
- Consult with original code authors when necessary
-
After Resolution:
- Test thoroughly after resolving conflicts
- Document significant conflict resolutions in PR description
- Create a branch
preview/x.y.z
from the appropriaterelease/*
branch - Apply specific preview configurations/branding
- Deploy to preview channels only
- Create a
support/x.y
branch from the appropriate release tag inmain
- Apply only critical bug fixes and security patches
- Tag patch releases within this branch as needed
For issues that can't wait for the standard hotfix process:
- Create a
emergency/issue-description
branch frommain
- Apply minimal changes to fix the critical issue
- Use expedited review process (document reviewers in PR)
- Deploy immediately after merge and tagging
- Backport to
develop
as soon as possible
- Set up branch protection rules from the start
- Configure template repositories with the correct branch structure
-
Preparation:
- Document current state of branches
- Identify completion point for in-progress work
- Back up existing repository
-
Implementation:
- Create
develop
branch frommain
/master
- Set up branch protection rules
- Start new work using the Bayat Git Flow
- Create
-
Gradual Transition:
- Complete existing work using the previous workflow
- Begin new work using Bayat Git Flow
- Full transition after one release cycle
- This document (
flow.md
) - Example workflows (stored in
conventions/git/examples/
) - Quick reference cheat sheet (
conventions/git/cheatsheet.md
)
- Initial team training sessions
- Buddy system for first-time usage
- Regular refresher sessions for updates
This Bayat Git Flow document should be reviewed and updated:
- After each major release cycle
- When new project types are introduced
- When significant workflows or technology changes occur
Updates to this document should follow the standard PR process with team review.
The Bayat Git Flow is designed to support all project types within the company while maintaining consistency and quality. By following these guidelines, we ensure efficient development, clear history, and stable releases across our diverse project portfolio.