Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code reviews with trunk based development

When doing trunk based development, all team members are (as far as I understand) supposed to push directly to Master (or main/trunk, whatever you call it). As illustrated here:

Trunk based development for a small team

Source

What I do not get about this approach, is how the code review fits in. You could of course do code reviews before merging any pull requests to Release, but I suppose that would be rather large reviews you would have to do.

Is it possible to put incoming pushes to Master on hold, until a code review is done?

Or is it necessary to make a seperate branch (perhaps one for each developer) to push to and then do code reviews when making a pull request to Master?

Update:

Assuming that you use feature branches for everything, you can of course just do the pull requests from the feature branches and code review those (as described in this post). But that requires everything to be in feature branches. And it was my understanding that part of a trunk based development was, that not everything requires a feature branch.

like image 848
Jakob Busk Sørensen Avatar asked May 24 '26 16:05

Jakob Busk Sørensen


1 Answers

trunkbaseddevelopment.com has a page on code reviews, and has this to say:

In Trunk-Based Development teams, the PR should be on a short-lived feature branch and processed very quickly by reviews towards merging back to trunk/master.

https://trunkbaseddevelopment.com/continuous-review/

like image 158
grg Avatar answered May 26 '26 11:05

grg