Remember that time you wanted to have a small get together at your apartment? You invited a few of your friends, bought a few drinks and put on some good music… then your friend Bob invited his roommates, your friend Alice invited her co-workers and all of a sudden it was a full blown party. It was a chaos.
Now think about your Git repo. Similar to the party, when there were only a few developers working on the same repo, everything was in order. But when a bunch of developers started showing up, it got a little out of hand.
At Soluto, we have two main repos with more than 100 developers worldwide making commits everyday. When we first started, everyone could push new code to a single master branch and it soon became a mess. Then we started requiring a PR (pull request) in order to push new code. It worked well for a while, but it wasn’t clear who should review the PR for each part of the code, and some chunks of code were neglected completely.
Code owners to the rescue
Github introduced a new cool feature last year called code owners. Code owners lets you define which team or developer is the owner of each piece of code. It’s super easy to use, and it introduced an efficient method of reviewing changes in a big repo.
How it’s done
All you have to do is define a CODEOWNERS file that uses a pattern with the same rules as .gitignore files. Then, in each PR the owners of the changed parts of the code will be required to approve the PR in order to merge it to the master branch. If you want to learn more about code owners, click here.
Now, you got yourself some organized code with well-reviewed PRs. You and other developers are more committed to the code, get to know it better and are more confident when pushing new code to production.
Taking it to the next level
Code owners changed the way we work and we love it. But, we often noticed that in big PRs — with many changed files — there were multiple owners who were requested to review the PR. It soon became tedious for the owners to track which files they had to review.
Introducing code owners Chrome extension
We developed a simple and useful Chrome extension that allows the code owner to click a button and instantly see only the files he’s the owner of. What’s going on behind the scenes, you may ask? Firstly, it locates the CODEOWNERS file, then identifies the files of which you’re the owner and need to review, filtering out the rest of the changed files. How cool is that?
So, now the code is more organized and clean because of the PRs. The developers know the code better thanks to the code owners feature. And the reviewers are happy to review code in a more efficient way with our awesome extension. 😉
If you want to try out our chrome extension, it’s available for download here.
Feel free to add any issues or PRs on our Github — this will help us out in improving the extension.
Originally published at Soluto Engineering Blog.
Top comments (0)