This is my second blog on parallel development using GitFlow. Its focus is to show how this model can be implemented using GitFlow with an Eclipse IDE along with EGit. You can read the previous blog here.
A summary of commands in sequence that are used is as shown below.
The first step is to initialize GitFlow as shown inside an Eclipse IDE below.
A switch to the develop branch occurs as shown below.
Starting a Feature
When beginning something non-trivial, it is a good idea to start a new feature. This “Start Feature” will be the default action when you click the GitFlow button if you are currently on the develop branch.
Commit your feature implementations to this branch. If you want, you can push the feature branch to your remote while you work on it (your team can decide on whether that’s normal practice or not).
If at any time you want to switch branches, either to another feature branch or to somewhere else, just use the normal mechanisms in GitFlow to do that. GitFlow will determine your context simply from the branch you currently have checked out.
Select ‘Start Feature’
Provide a name for the Feature
Switch to Feature A branch defined
This action creates a new feature branch based on “develop” and switches to Feature A branch defined.
Finishing a feature
When you’re done implementing a feature, use the ‘Finish Feature’ action and the feature branch will merge into the main development branch, essentially queueing it for inclusion in the next release.
Feature branches are deleted by default but you can opt to retain them if you like.
This action performs the following:
Publishing a feature
Are you developing a feature in collaboration?
Publish a feature to the remote server so it can be used by other users.
Getting a published feature
Get a feature published by another user.
Starting a release
You start a release branch when you want to start preparing a new release, which probably coincides with a feature freeze.
Most of the time, you want to start the release from the latest commit in the development branch, but you can choose to base it on another commit. This essentially freezes the release, so it’s not affected by subsequent development.
You can also perform preparatory tasks for the release process on this branch, such as updating the version number in source files, updating changelogs, or committing other tweaks. Once these tweaks are done, you can finish the release as described below.
It’s wise to publish the release branch after creating it to allow release commits by other developers. Do it like feature publishing with the command.
Finish up a release
Finishing a release is one of the big steps in Git branching. It performs several actions:
Finishing a release (Eclipse)
Starting a hotfix
What if you need to just fix a bug on the latest release? You don’t want to create a new release, because that will pick up the recent changes from the development branch. Instead, you can start a “hotfix.”
A hotfix or quick-fix engineering update is a single, cumulative package that includes information (often in the form of one or more files) that is used to address a problem in a software product (such as a software bug). Hotfixes always start from the latest production code from the “master” or “default” branch. Other than that, they’re basically the same as release branches.
Moreover, when you’re finished with the hot-fix, they behave the same way as finishing a release branch. The changes are merged back into both the production branch and the development branch, and a tag is created on the production branch for the hot fix release.
Like the other GitFlow commands, a hotfix is started with:
Hotfix Creation (Eclipse)
Finish a hotfix
By finishing a hotfix, it gets merged back into develop and master. Additionally, the master merge is tagged with the hotfix version.
Finish Hotfix (Eclipse)
GitFlow is a great way to automate your handling of branch-based development, and using an Eclipse IDE with EGit and GitFlow plugins, now provides a simple and clear way to use it with an easy-to-use and intuitive Graphical User Interface or GUI.