Picture of Brian Love wearing black against a dark wall in Portland, OR.

Brian Love

Git + git-flow

Using the Git-flow model with Git makes it easy to work on features, releases and hotfixes.

I have been using the GitHub app for Mac OS X for some side projects for awhile, and found it to be pretty useful. For some stuff, I ended up using terminal, but that was ok. For a new project, we recently migrated our SVN repository to a BitBucket Git repository, and have been learning a lot about SourceTree and git-flow.

This is the standard setup of your branches in git using the git-flow model:

New Features

For a new features the work flow allows us to hum along on our work without interrupting others.

You can use SourceTree to create the new feature, and to finish the feature. You can also use the terminal shell. The commands to start a new feature are:

$ git flow feature start {JIRA issue ID}

When you have completed the features, just execute:

$ git flow features finish {JIRA issue ID}

If you are ready to push your feature to the remote develop branch:

$ git flow feature publish {JIRA issue ID}

Hotfixes

For a critical/blocking issue that must be dealt with immediately, and pushed into our master (production) branch, the work flow is:

Bash command to start hotfix:

$ git flow hotfix start {JIRA issue ID}

Finish the hot fix:

$ git flow hotfix finish {JIRA issue ID}

Releases

When you have tested your code and are ready to create a new release, git flow makes it really easy to create a new release branch. In SourceTree, just create a new release and use the version string you want to identify this release with. If you are using the terminal enter the following bash command:

$ git flow release start {version id}

After you have created the new release branch, you can use this branch to make any final version number changes, or other necessary changes. Perform final QA testing using this release. Once QA tests are completed and pass successfully, you are ready to merge your release branch into the master branch. You can do this in SourceTree by going to Git Flow > Finish Release and select the release that you are merging into master, or enter:

$ git flow finish release {version id}

Conclusion

Git + git-flow = Happy Developers