Gitflow for a complex project
Home » BLOG » Web development » Gitflow for a complex project

Gitflow for a complex project

category:  Web development

Last month, I had to work on a complex WordPress website and I had to work with other developers. The source code is stored on 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 various useful extensions and enable or disable these extensions anytime you want with just one click and it doesn’t require restarting the VScode after enabling or disabling 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, with 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 of my team.
  • Clone the develop branch and name it your feature name branch. For example, slider feature, invoice module, and 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 on your changes.
  • Once your fixing regarding the feedback at the pull request is done, you will merge your feature branch to develop branch.
  • Once your team finishes their own features branch and merges 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 the sandbox or staging server for testing purposes. Once all new features or fixed issues are well tested and no errors, you can merge to the master branch.

Deploy a project to a remote server with Git push

To save time for developers to deploy tasks, there are some tools that help 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. A list of these tools is below.

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