
上QQ阅读APP看书,第一时间看更新
Keeping the dev Branch Bug-Free
The first issue can be tackled by merging the dev branch into social-login/main, testing that everything works as normal, and then merging it back into dev:
$ git checkout social-login/main
$ git merge dev
$ git checkout dev
$ git merge social-login/main
This way, any bugs that arise due to the incompatibility of the branches will remain on the feature branch, and not on dev. This gives us a chance to fix these bugs before merging back into dev.
While this solved one issue, it exacerbated the other. Our Git history now looks like this:
Merging the main branch first is not as important for sub-feature branches, because feature branches are not expected to be bug-free at all times. I'd leave it up to the developer responsible for the feature branch to decide how they'd want to work on their feature branch.