- Add comprehensive BUILDING.md with branch strategy - Document feature/bugfix/hotfix workflows - Provide merge vs rebase guidelines - Include common git commands reference
4.3 KiB
4.3 KiB
newzy Building System
Git Branching Strategy
We follow a standard Git workflow with the following branches:
Main Branches
-
main- Production-ready code, stable releases- Contains only production-ready, tested code
- Deployed to production environment
- Protected branch requiring pull request approval
-
develop- Integration branch for feature development- Primary integration branch for all features and enhancements
- Should be in a deployable state at all times
- Merged into
mainbefore release (feature releases)
Feature Branches
feature/<name>- New features and enhancements- All new work should happen in feature branches
- Create from
developbranch - Follow naming convention:
feature/short-description - Example:
feature/user-authentication,feature/article-search
Bugfix Branches
bugfix/<name>- Bug fixes from develop- Used for bug fixes found in the develop branch
- Create from
developbranch - Follow naming convention:
bugfix/short-description - Example:
bugfix/login-page-layout,bugfix/comment-not-saving
Hotfix Branches
hotfix/<name>- Critical fixes from main- Used for urgent production bug fixes
- Create directly from
mainbranch - Merge hotfix to both
mainanddevelopafter completion
Release Branches (Optional)
release/vX.Y.Z- Preparation for release- Final preparations before deployment to production
- Bug fixes and final testing only
Git Workflow Guidelines
When to Use Each Branch
| Scenario | Source Branch | Target Branch(es) |
|---|---|---|
| New feature | develop |
develop → main |
| Bug in develop | develop |
develop |
| Production bug fix | main |
main → develop |
| Minor enhancements | develop |
develop → main |
Pull Request Process
- Create a feature branch from the appropriate source branch
- Make your changes and ensure all tests pass
- Update documentation if necessary
- Submit a pull request to the target branch
- Request review from team members
- Address feedback and make required changes
- Merge to target branch after approval
Merge vs Rebase
Recommended: Merge Commits
- Preferred for integrating feature branches into
develop - Maintains clear history of when features were integrated
- Simple, linear merge process
# Merge a feature branch into develop
git checkout develop
git pull origin develop
git merge <feature-branch> --no-edit # or use merge message
git push origin develop
When to Rebase
- Rebasing recommended when:
- Maintainer rebasing feature branches before merging
- Cleaning up local branches with
git rebase -i
# Interactive rebase for history cleanup
git checkout <feature-branch>
git rebase -i develop
git push origin --force-with-lease <feature-branch>
# Merge after rebase
git checkout develop
git merge <feature-branch>
git push origin develop
Pull Request Guidelines
Title Format:
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat:- New featurefix:- Bug fixdocs:- Documentation changesstyle:- Formatting changesrefactor:- Code refactoringperf:- Performance improvementstest:- Test additions/changeschore:- Maintenance tasks
Example:
feat(auth): implement OAuth2 authentication
- Add Google OAuth provider integration
- Implement refresh token handling
- Update login page with social login options
Closes #42
Code Review Process
- Self-review: Ensure code quality before submitting PR
- Team review: At least one other team member must review
- Automated checks: All CI/CD checks must pass
- Approval: Required approval from maintainer(s)
- Merge: Squash merge or rebase merge as appropriate
Common Git Commands
# Clone repository
git clone <repository-url>
# Create and checkout feature branch
git checkout -b feature/my-feature develop
# Commit with conventional commits
git add .
git commit -m "feat(auth): implement OAuth2 authentication"
# Push to origin
git push origin feature/my-feature
# Update local develop branch
git checkout develop
git pull origin develop --rebase
# Merge feature into develop
git merge <feature-branch>
Last updated: $(date +%Y-%m-%d)