Git - Branching Models

From Training Material
Jump to navigation Jump to search

THIS IS A DRAFT

This text may not be complete.

title
Git Branching Models
author
Lukasz Sokolowski

Branching models ⌘

  • The release and trunk branches workflow
  • The graduation, or progressive-stability branches workflow
  • The topic branches workflow
  • Git-flow

The release and trunk branches workflow ⌘

  • single integration branch (usually master)
  • centralized way
  • release candidates are cut (tagged) from the release branch

The graduation, or progressive-stability branches workflow ⌘

  • You should never merge a less stable branch into more stable one, as merging would bring all the unstable history

Grad or progressive.png

The topic branches workflow ⌘

  • Example1. The topic branches workflow with one integration branch ( master ) and three topic or feature branches.
    • Among the topic branches, there is one (namely, newidea ) already merged in the integration branch and one ( iss-95-2 ) dependent on the feature developed in the other feature branch ( iss-95 here)

Topic.png

  • Example2. The topic branches workflow with two graduation branches.
    • Among topic branches, there is one ( iss92 ) that is considered stable enough to be merged into both the next (unstable) and master (stable) graduation branches.
    • One ( idea ) that got merged into next for testing and one ( feat ) just created from master
    • Example of scenario (next slide)

Topic1.png

Example of scenario ⌘

  • Example of scenario (maintainer (the release manager) creates a new release)
git log master..maint (check if empty, if not then test and try to merge maint into master)
git tag -s -m "Foo version 1.4" v1.4 master
git push origin v1.4 master

git checkout maint
git merge --ff-only master

git checkout next
git reset --hard master
git merge ai/topic_in_next_only_1...
(git branch --no-merged next)

git pull
...
+ 990ffec...cc831f2 next -> origin/next (forced update)
...

Git-flow ⌘

  • more advanced version of the topic
  • uses two main long-running graduation branches to separate the production-ready stable state from the work involved with integration of the latest delivered ongoing development
  • Each new feature is developed on a topic branch
  • Release branches are forked off when the stable state reflects, or is close to, the desired state planned for the new release
  • The release branch might exist only until the time the project release it was created for is rolled out, or it might be left to gather maintenance work: bug fixes for the given release
  • Hotfix branches are like release branches, but for an unplanned release usually connected with fixing serious security bugs

Git flow.png