Preloader image

The GitFlow Workflow

Notes before you begin (mostly for SVN users):

  • The 'develop' repository is the equivalent of the SVN trunk directory.

  • The 'master' repository is the equivalent of the SVN tags directory.

  • The 'origin' is the actual GIT repository that contains the projects master, develop and other branches (Like trunk, branches and tags).

  • Unlike SVN a 'commit' is only a local action. The local commits are only published to the remote repository using 'push'.

  • Commit and push code to your own feature branch as often as you like, but only merge stable branches back into to the develop branch.

  • Only the release manager should manage the master repository

  • Read the official Apache Committer documentation here

Run commands in the directory of the project you are working on, for example 'tomee':

Always create a feature branch from develop using an 'extremely' descriptive name, this should usually be the JIRA id or task name you want to work on:

git checkout -b TOMEE-007 develop

Switched to a new branch 'TOMEE-007'
git status

nothing to commit, working directory clean

Immediately push the new branch to the repository so everyone can see it remotely (and possibly collaborate):

git push -u origin TOMEE-007

Branch TOMEE-007 set up to track remote branch TOMEE-007 from origin.

Once that is done then you just need the simple push for subsequent calls on this branch:

git push

Work like mad on the JIRA issue calling commit and add as often as you like…​

If others are working on your branch also remember to pull their changes (Or just as good practice):

git pull

git commit

git push

Finally, to push the completed (or significant non-breaking progress on the) feature to develop at any time (ensuring develop is up to date first):

git pull origin develop
git checkout develop
git merge --no-ff TOMEE-007

Once the completed feature is merged and the JIRA resolved then the branch can and 'should' be deleted before pushing:

git branch -d TOMEE-007
git push origin develop

The GUI Way

Now we have learned to do it the hard way, time to look at the simplified version. The GitHub native tools!

For the latest mac version go here: Mac Latest,

And windows here: Win Latest

These tools will probably not save you much time over the command line, but provide a much better visualization of ongoing processes.

The steps are and remain as described above:

  1. From develop create a new branch called, for example TOMEE-007

  2. 'Publish' (push -u) the new branch

  3. Work on the branch and commit regularly

  4. Synchronize (pull and push) changes in the the branch when stable

  5. Switch to develop and synchronize (pull)

  6. Merge the branch into develop, i.e. 'TOMEE-007' + 'develop' = 'develop' *See note below

  7. Commit develop

  8. Synchronize develop (pull and push)

  9. Delete the branch TOMEE-007

You can actually merge the current *develop_ (or any other 'synchronized' branch) into your branch first to make sure it is stable,i.e. 'develop' + 'TOMEE-007' = 'TOMEE-007' - This is really cool!