Sobes.tech
Junior

What is Git Flow?

sobes.tech AI

Answer from AI

Git Flow is a branching model in Git proposed by Vincent Driessen. It defines a strict set of rules for organizing branches and managing the project lifecycle.

Main branches:

  • master: Contains production-ready code, always stable.
  • develop: The base branch for developing new features.

Supporting branches:

  • feature/...: For developing individual features. Branches off from develop, merged back into develop. They are asynchronous to each other.
  • release/...: For preparing a new release. Branches off from develop, merged into develop and master. Fixes bugs related to the release.
  • hotfix/...: For quick fixes of critical errors in production. Branches off from master, merged into develop and master.

Branch lifecycle for feature:

  1. git checkout develop
    
  2. git pull
    
  3. git checkout -b feature/my-new-feature
    
  4. Development and commits.
  5. git checkout develop
    
  6. git pull
    
  7. git merge feature/my-new-feature
    
  8. git branch -d feature/my-new-feature
    

Advantages:

  • Clear structure and organization of work.
  • Reduces conflicts during merging.
  • Easy to understand for new team members.

Disadvantages:

  • Can be overly complex for small projects or teams.
  • Requires adherence to strict rules.