This is a Servoy Tutorial on how to use Git, Git Flow, and Atlassian SourceTree (GUI for Git Flow) with Servoy. In this Servoy tutorial I present the Git Flow model that is working well for me on all my big projects. I also explain how to setup Git Flow with Servoy, and even include a video demonstrating how to do some basic branching. It should be enough to get you started.
Using a repository for source code control is imperative, regardless if you are a lone developer, a small team of developers, or a big team. Without it, you are in big trouble; its only a matter of time before you loose it all due to a hard drive failure or other disaster.
I’m not going to get into a debate with anyone over the pros and cons of Git versus centralized source code control systems like subversion or svn. There are plenty of flame wars on this topic already underway on the web. The bottom-line for me, is that Git is designed for branching, where as for other centralized systems like svn, it is an advanced topic and considered a bit scary (“watch out for merge conflicts…”). With Git, branching is extremely easy and part of my everyday workflow. I can create feature branches, hot fix branches, release branches, collapse branches, all without fear, and with minimal effort. I will never go back to a centralized system like svn, and any client I work with, will be lectured on the importance of switching to Git. Yes…I feel that strongly about it.
With Git there is a central repository (repo) called origin. Each developer then has a local copy of origin that they use to make their changes in. When they finish making changes, they can push those changes up to origin. Other developers can then pull those changes down to their local repository. Developers can also push and pull to/from each other, if they want to test something before pushing to origin.
At the core, the Git Flow model has two main branches at origin:
The origin/master is the branch that is our production ready state. It is the code we have stabilized and is being deployed for our customers.
The origin/develop branch contains everyone’s latest development changes that have been pushed up from their local repositories. This is also where nightly builds are made.
There are several supporting branches that are used in Git Flow in addition to the master and development branches. They include:
Technically, these additional branches all function the same way. The only real important factor is where they are originate from, and where they merge when closed, which is all handled by Git Flow (think of Git Flow as the Git workflow).
When the code in the development branch reaches a stable point, a release branch can be made using the Git Flow button in SourceTree. This will create a new release branch from development, isolating the code into a new release branch, where it will be stabilized until it is ready to be released into production. A build is prepared from the release branch and installed on QA servers, so that testing can begin. If any fixes are needed, developers can easily switch from their development branch to the release branch, fix the issue, make a new pre-release build, and deploy it for QA. This is really where the Git repo system begins to shine.
The QA testing and fixing on the pre-release branch continues until a point where it is now ready to go to production. At that point, Git Flow is used to close the release branch and merge it into the production and development branches, ensuring that all changes made in the release branch, are merged back into both. Once merged into production, a build is prepared for distribution to all production servers.
At any point in time, if a critical issue is detected in production, a hot fix branch can be made using Git Flow. Developers can easily switch to the hot fix branch, resolve the issue, and then merge it back into production and development.
Feature branches are made off of development, and allow developers to work on significant and large features, thereby isolating that work. The release timeline for the feature may well be unknown, and if an experiment that ends in disaster, does not affect any other work in the development branch, and can simply be discarded. After a feature has been fully developed, it can be collapsed back into the main development branch.
There is no limit to the number of feature branches that can be open at one time. This lends itself really well to an agile development environment, where developers constantly have to switch branches to work on new features as specifications are gathered that are required for work to proceed.
By isolating these features off of the main development branch, the team is still able to cut a release at any time, and not worry about the effects an unfinished feature may have on a new release.
There is really nothing unique about this branching model outlined here; it is simply the Git Flow built into SourceTree, and it works really well with Servoy and the needs of today’s agile development teams. More importantly, with Git Flow, the branching strategy forms an elegant model that is easy to comprehend and allows all the team members to move forward with confidence in a unified branching and release process.
Git Flow is where its at, and SourceTree is the tool to use. Let’s set it up and get to work!
Here are the Servoy tutorial steps to setup Git and SourceTree with Servoy.
This video will demonstrate how to work with GitFlow in SourceTree, and do basic branch switching. I think watching it in use, as opposed to a written description, makes more sense for this Servoy tutorial.
Well, there you have it; how to setup Servoy/Eclipse, Git, Git Flow and SourceTree. As I said at the start, Git Flow is so much easier to work with then svn or subversion (in my opinion), and it does a much better job in allowing you to switch branches, something that is a frequent occurrence throughout the day in our fast paced agile environments. Give it a try now; once you do, I know you will convinced, and never go back.
That concludes this Servoy tutorial. I hope you found it helpful.
This is a Servoy tutorial on how to optimize code performance. A while back, I had…
This is an object-oriented Servoy tutorial on how to use an object as a cache in…
This is an object-oriented Servoy tutorial on how to use function memoization with Servoy. Function memoization…
This is an object-oriented Servoy tutorial on how to use object-oriented programming in Servoy. Javascript’s core…
This is an object-oriented Servoy tutorial on how to use inheritance patterns in Servoy. I use…
This is an object-oriented Servoy tutorial on how to use prototypal inheritance in Servoy. When…
View Comments
SourceTree appears to require a Windows 2007 or higher operating system for all Windows installs (ie. not for those who still have Windows XP or Server 2003 requirements). Another reason to update old equipment!
I'm not surprised; Windows 7 has been out for sometime now. I can highly recommend Windows 7; very stable and works great with all apps. I would still stay away from Windows 8.
Thank you, this is really useful.