RidgeRun Developer Manual - Methodologies - Gitflow

From RidgeRun Developer Connection
Jump to: navigation, search




Previous: Methodologies Index Next: Methodologies/Project Cycles





About Gitflow Methodologies

A "gitflow" methodology is no more than a set of practices that define the workflow for software development involving a version control system like git. RidgeRun follows a "homegrown" methodology based on the feature branch model. This model has several advantages:

  • It is very well suited for project scheduled on release cycles.
  • Allows to maintain a stable code base for all developers involved after each release, which synergizes very well with continuous integration practices.
  • Feature branches allow to implement pull requests, a type of code review.
  • Feature development isolation. Each developer works on its branch and does not affect the development of other branches by other developers.
  • There are very well defined roles for a git branch, for example, there is the development branch, the master branches, the hotfix branches, etc.

Overview

The RidgeRun git worflow can be summarized in the figure below:

Error creating thumbnail: Unable to save thumbnail to destination

The process goes as follows:

  1. The project starts with a single commit in the ​ main branch, from where the ​ develop branch is started.
  2. From the ​ develop branch, developers branch out ​ features​ , which eventually get merged back into ​develop​.
  3. Eventually, when the time comes, a new release branch is branched out from ​ develop​. The ​ release branch is tested thoroughly and, when ready, is merged into ​main and into develop​.
  4. The merge into ​ main​ is considered a release and must be tagged accordingly.
  5. The process repeats from point 2.
  6. If eventually a critical issue is found on the ​main branch, a ​ hotfix is branched out from it, fixed, and merged back into ​ main​ and ​ develop​ .

Concepts

Main

  • Formerly called "master".
  • It is always​ stable, aka: should always build and run.
  • Never do a commit directly
  • Never allowed to do forced push ( git push -f ) on it.

Initial commit

  • The content is typically a README.md containing a description of the project.
  • The typical commit message is:
Initialize project.
Error creating thumbnail: Unable to save thumbnail to destination

Initial develop commit

  • Purely aesthetic.
  • Created with:
git commit --allow-empty -m "Initialize develop"
Error creating thumbnail: Unable to save thumbnail to destination

Some particular considerations on the feature branch model

Rebasing feature branches

Let's assume this scenario, person A and person B are working in parallel each one on individual feature branches that diverged from the same commit in the development branch. Now, let's assume person A got his/her feature branch approved first than person B. Once person A merges the feature branch in the development branch, person A should tells person B that he/she needs to rebase his/her feature branch, so person B can follow these commands:

 git fetch # update you local repo from the remote repo
 git checkout develop
 git pull
 git checkout feature/person-b-feature
 git rebase develop # This may arise merge conflicts that have to be solved

The following figure illustrates this process:

Rebase-feature-branches.png

But why rebasing features branches is required? There are several reasons to it:

  • Makes it easier to track issues in the development branch, since this branch will have clear points where the feature branches where merged (see Merging feature branches).
  • Each developer will have the latest code base in its local repo which implicitly allows for testing the feature that was originally developed in another system. Sometimes this helps find issues.

Merging feature branches

 git checkout develop
 git merge --no-ff feature/awesome-feature # Creates merge commit


Previous: Methodologies Index Next: Methodologies/Project Cycles