Ce qu'est Git Flow
Git Flow est un modèle de branching proposé par Vincent Driessen en 2010. Il définit cinq types de branches — main, develop, feature/*, release/*, hotfix/*.
Les cinq branches
main- code prêt pour la production.develop- branche d'intégration pour la prochaine release.feature/*- depuisdevelop, mergée versdevelop.release/*- depuisdevelop, mergée versmainet retour.hotfix/*- depuismain, mergée versmainetdevelop.
Cycle de vie d'une feature
git checkout develop
git pull
git checkout -b feature/oauth-login
git checkout develop
git merge --no-ff feature/oauth-login
git push origin develop
git branch -d feature/oauth-login
Une release
git checkout develop
git checkout -b release/1.4.0
git checkout main
git merge --no-ff release/1.4.0
git tag -a v1.4.0 -m "Release 1.4.0"
git checkout develop
git merge --no-ff release/1.4.0
git branch -d release/1.4.0
Un hotfix
git checkout main
git checkout -b hotfix/1.4.1
git checkout main
git merge --no-ff hotfix/1.4.1
git tag -a v1.4.1 -m "Hotfix 1.4.1"
git checkout develop
git merge --no-ff hotfix/1.4.1
La CLI git-flow
brew install git-flow-avh
git flow init
git flow feature start oauth-login
git flow feature finish oauth-login
Quand Git Flow convient
- Logiciel téléchargeable versionné.
- Maintenance parallèle de plusieurs versions.
- Cycles de QA longs.
Quand Git Flow ne convient pas
- Apps web déployées en continu.
- Petites équipes sans processus dédié.
- Cultures trunk-based.