Common Git Workflows
Explore the different Git workflows for managing your projects.
I
InSkillCoach
· min
Common Git Workflows
Explore the different Git workflows for managing your projects.
Git Flow
Branch Structure
# Main branches
main # Production
develop # Development
# Supporting branches
feature/* # New features
release/* # Release preparation
hotfix/* # Urgent fixes
Workflow
- New Feature
# Create a feature branch
git checkout -b feature/nouvelle-fonctionnalite develop
# Develop and commit
git add .
git commit -m "Ajout de la nouvelle fonctionnalité"
# Merge into develop
git checkout develop
git merge feature/nouvelle-fonctionnalite --no-ff
- Release
# Create a release branch
git checkout -b release/1.0.0 develop
# Prepare the release
# - Update the version
# - Fix bugs
# - Update the documentation
# Merge into main and develop
git checkout main
git merge release/1.0.0 --no-ff
git tag -a v1.0.0 -m "Version 1.0.0"
git checkout develop
git merge release/1.0.0 --no-ff
GitHub Flow
Simple Structure
main # Production
feature/* # Features
Workflow
- New Feature
# Create a feature branch
git checkout -b feature/nouvelle-fonctionnalite
# Develop and commit
git add .
git commit -m "Ajout de la nouvelle fonctionnalité"
# Push and create a Pull Request
git push origin feature/nouvelle-fonctionnalite
- Code Review
# After the review, merge into main
git checkout main
git merge feature/nouvelle-fonctionnalite
git push origin main
GitLab Flow
Structure with Environments
main # Production
staging # Staging
preprod # Pre-production
feature/* # Features
Workflow
- Development
# Create a feature branch
git checkout -b feature/nouvelle-fonctionnalite
# Develop and commit
git add .
git commit -m "Ajout de la nouvelle fonctionnalité"
# Push and create a Merge Request
git push origin feature/nouvelle-fonctionnalite
- Deployment Pipeline
# After validation, merge into staging
git checkout staging
git merge feature/nouvelle-fonctionnalite
# Then into preprod
git checkout preprod
git merge staging
# Finally into main
git checkout main
git merge preprod
Trunk-Based Development
Minimalist Structure
main # Main branch
feature/* # Short-lived features
Workflow
- Development
# Create a short-lived feature branch
git checkout -b feature/petite-fonctionnalite
# Develop quickly
git add .
git commit -m "Ajout de la fonctionnalité"
# Merge quickly into main
git checkout main
git merge feature/petite-fonctionnalite
Best Practices
-
Choosing a Workflow
- Team size
- Project type
- Release frequency
- Quality requirements
-
Branch Management
- Descriptive names
- Short lifespan
- Regular cleanup
- Branch protection
-
Review Process
- Approval criteria
- Automated tests
- Documentation
- Communication
Conclusion
Key takeaways:
- Different workflows for different needs
- Collaboration processes
- Version management
- Code quality
Recommendations:
- Choose the right workflow
- Adapt it to your needs
- Automate your processes
- Follow best practices
- Keep learning Git
About InSkillCoach
Training and technology expert
Coach specializing in advanced technologies and AI, backed by GNeurone Inc.
Certifications:
- AWS Certified Solutions Architect – Professional
- Google Cloud certifications
- Microsoft Certified: DevOps Engineer Expert
- Certified Kubernetes Administrator (CKA)
- CompTIA Security+
1.7k
129
Comments
Comments are powered by GitHub Discussions
Sign in with GitHub to join the discussion