Git workflow to manage the work of multiple branches

Strategies when using Git as a project version control tool

I use Git to track all my development, and I always follow this strategy.

The strategy is inspired bySuccessful Git branch model.

I have 2 permanent branches: mastery and development.

These are the rules to follow in my daily work:

When I ask a new question or decide to merge a feature, there are two main paths:

  • This feature is a quick feature, otherwise the subsequent commits I will make will not break the code (or at least hope so): I can develop or doFast feature branch, And then merge them for development.

  • This feature will require multiple submissions, and it may take several days to submit before the feature is completed and becomes stable again:I make a feature branch, And then merge and develop.

If our stuffThe production server needs immediate action, Just like a bugfix, I need to fix it as soon as possible, I made aShort patch branch, Fix the problem, test the branch locally and on the test machine, and then merge it to master and develop.

If i need oneQuick function/editTo push to the production server, the develop branch contains some unstable code, I hope to function/edit as soon as possible, I canSkip the develop branch, execute the fast feature branch and merge it into master and develop, As long as the function/editing is fast and trivial. If it turns out that this will become more complicated, it is better to wait and stabilize the code on the development branch.

ThisThe development branch will always be in a state of constant change, Which is why it should be placed in the "freeze'In preparation for the release. The code was tested, and each workflow was checked to verify the code quality, and was ready for merging into the master.

Every time a development or another patch branch is merged into master,I markWith a version number, so if there is a problem, it is easy to return to the previous state.

More git tutorials: