DEV Community

Saranyavenkat618
Saranyavenkat618

Posted on

Git WorkFlow

Git is the most commonly used version control system today. A Git workflow is recommendation for how to use Git to accomplish work in a consistent and productive manner. Git workflows encourage developers and DevOps teams to leverage Git effectively and consistently. Git offers a lot of flexibility in how users manage changes. Given Git's focus on flexibility, there is no standardized process on how to interact with Git.

Working of Git Flow

Develop and Master Branches
Instead of a single master branch, Git Flow uses two branches to record the history of the project. It is based on two main branches with infinite lifetime namely master and develop.

Master Branch: The master branch contains the production code and stores the official release history.

Develop Branch: The develop branch contains pre-production code and serves as an integration branch for features.

Image description

Feature Branch

Each new feature should reside in its branch, which can be pushed to the central repository for backup/collaboration. Feature branches use the latest develop as their parent branch. When a feature is complete, it gets merged back into develop. Features should never interact directly with the master branch.

Image description

Release Branch

Image description

Hotfix Branch
Maintenance or “hotfix” branches are used to quickly patch production releases. Hotfix branches are necessary to act immediately upon an undesired status of master. Hotfix branches are a lot like release branches and feature branches except they’re based on master instead of develop. This is the only branch that should fork directly off of master. As soon as the fix is complete, it should be merged into both master and develop (or the current release branch), and the master branch should be tagged with an updated version number.

Image description

Advantages of Git Flow

  1. Now let’s talk summarize the major advantages provided by Git flow:
  2. Ensures a clean state of branches at any given moment in the life cycle of a project
  3. The naming convention of branches follows a systematic pattern making it easier to comprehend
  4. Has extensions and support on most used git tools
  5. Ideal in case of maintaining multiple versions in production
  6. Great for a release-based software workflow.
  7. Offers a dedicated channel for hotfixes to production.

Disadvantages of Git Flow

  1. Well nothing is ideal, so Git Flow holds some disadvantage as well like:
  2. Git history becomes unreadable
  3. The master/develop branch split is considered redundant and makes the Continuous Delivery/Integration harder
  4. Not recommended in case of maintaining a single version in production

Top comments (0)