My last company used Github to manage code.
Everyone who implements a new feature opens a feature branch, submits a pull request, and merges the Develop branch after the code review.
This is a standard set of actions. But in practical work, we always come across such a problem.
The different branches of the commit are merged into develop after the merge.
For some reason, you often need to roll back code that has been merged into Develop.
There were times when we found it impossible to roll back some code accurately because the code for each feature Branch was so integrated.
If there are features that need to be released, but can’t be rolled back due to the incorporation of buggy code, this is a very urgent situation.
This was a problem that plagued us for a long time, and the final solution was a little Git feature called Squash Merge.
Squash Merge Is a Squash Merge that merges all the commits on a branch into a commit and then merges the target branch.
On the command line git merge –squash
On Github, you can configure a pull request that only allows squash merge. You can go to Settings -> Merge Button on the REPo.
With Squash Merge, each branch that is merged has only one COMMIT on Develop, making it easier to undo either one.
A squash merge allows each pull request to have only one COMMIT. In this way, each pull request does not interfere with each other.