gitflow for a complex project
» » » Gitflow for a complex project

Gitflow for a complex project

posted in: Web development
2 min read

Last month, I had to work on the complex WordPress website and I had to work with other developers. The source code stores in GitHub since it is easy to use and organize for me.

In order to connect to GitHub, you have to use Git which is a modern version control system. With Git, you can push and pull all changes to the repositories on Github.

For my development, I use Visual Studio Code editor which is my favorite editor tool by far. In the past, I use PHPStorm, Atom, NetBeans, Eclipse and Sublime text. I found out the Visual Studio Code tool (aka VScode) is faster to compare with all these tools. Plus it is free. With VScode, you can install varies useful extensions and enable or disable these extensions anytime you want just one click and it doesn’t require to restart the VScode after enable or disable the extensions. With VScode, it has integrated Git support in-the-box. It is great!

The idea to use Gitflow

In a complex project with a team, I want to control all codebase to be clean, no conflict and easy to track. I found out the Gitflow idea is great for me. Below are the steps that I follow.

  • Create the master branch which will use for a production site
  • Clone the master branch and name as develop branch. This develop branch, I use for merging the changes from other branches from my team.
  • Clone the develop branch and name as your feature name branch. For example, slider feature, invoice module, timesheet module.
  • You and your team will develop a new feature in your own feature branch.
  • Once your feature is done and ready for testing, you will create the pull request to compare changes between your feature branch and develop branch. With the pull request, your team will get a notification and can give your feedback for your changes.
  • Once your fixing regarding the feedback at pull request is done, you will merge your feature branch to develop branch.
  • Once your team finishes their own features branch and merge the changes to the develop branch, you will merge the develop branch to the master branch.
  • Finally, you will deploy the master branch to the production site.

Note that, for develop branch, you can deploy to sandbox or staging server for testing purpose. Once all new features or fixed issues are well tested and no error, you can merge to master branch.

Deploy a project to a remote server with Git push

To save time for developers to deploy task, there are some tools that help the developers focus on what they do best. Basically, these tools will deploy the changes from the master branch (any branch that you decide to deploy to the production site) to the production server after you push the changes to the repositories by Git command. Some list of theses tool is below.

That’s it for today. Hope it is useful for everyone.