Skip to content

Git flow

Joanna edited this page Aug 5, 2023 · 2 revisions

Git Flow - Guide to Code Management Methodology in Git

Git Flow is a popular and efficient methodology for managing code flow in a Git repository. It was created by Vincent Driessen and relies on branching and the appropriate use of tags to organize the software development process. Below are the main principles and rules of Git Flow:

  1. Main Branches:
    Master / Main: The main branch that holds stable production code. All changes on this branch should be thoroughly tested and ready to be released as a new version of the software.
    Develop / Dev: The development branch from which new features and enhancements are created. It is where daily development work takes place.
    Feature: Branches for new features. Each feature should be developed on a separate branch and merged into the develop branch after testing.

  2. Feature Lifecycle:

    • Start a new feature branch from the develop branch.
    • After completing work and testing the feature, merge it into the develop branch.
    • Delete the feature branch after it's finished.
  3. Bugfix Branches:

    • Start a new bugfix branch from the master branch if a bug has been reported in the production version.
    • After fixing the bug, merge the bugfix branch into the master branch.
    • Additionally, merge changes from the bugfix branch into the develop branch to maintain consistency.
  4. Release Branches:

    • Start a new release branch from the develop branch when you are ready to prepare a new version of the software.
    • Perform final tests and version adjustments on this branch before releasing it as stable.
    • After completing, merge the release branch into both the master and develop branches and tag it with a version label.
  5. Hotfix Branches:

    • Start a new hotfix branch from the master branch if you urgently need to fix a bug in the production version.
    • After finishing work, merge the hotfix branch into both the master and develop branches.

Git Flow is a useful methodology for larger projects and development teams. It helps maintain order in code development and allows for flexible changes. Remember that using the right tools and understanding the principles of this methodology are essential for its effective implementation.

Git flow workflow:

Install Git Flow:

pip install git-flow

Start a New Feature: Begin working on a new feature in your Python project using Git Flow (you have to be on branch dev):

git flow feature start my-new-feature

Make and Commit Changes: Add and commit changes to your new feature:

git add . git commit -m "Add new feature functionality"

Finish the Feature: When you're done with the feature, finish it using Git Flow:

git flow feature finish my-new-feature

Push Changes: After finishing the feature, push your changes to the remote repository:

git push

Clone this wiki locally