Senior
How is git flow organized — branches, environments, deployment?
sobes.tech AI
Answer from AI
Git Flow is a popular branching model that helps organize development and deployment.
Main branches:
- master — contains stable code ready for production.
- develop — integration branch for development, from which new releases are made.
Supporting branches:
- feature/ — for developing new features, branched from develop and merged back into develop.
- release/ — for preparing a release, branched from develop, merged into master and develop after testing.
- hotfix/ — for urgent fixes in production, branched from master and merged into master and develop.
Environments usually correspond to branches:
- develop — staging or testing environment;
- master — production.
Deployment occurs from the master branch after passing all tests and release verification. Hotfix branches allow quick bug fixes in production without waiting for the next release.
Example commands:
# Create a feature branch
git checkout develop
git checkout -b feature/new-feature
# After completing work
git checkout develop
git merge feature/new-feature
# Create a release
git checkout develop
git checkout -b release/1.0.0
# After testing
git checkout master
git merge release/1.0.0
git checkout develop
git merge release/1.0.0
# Delete the release branch
git branch -d release/1.0.0