Effective Code Review Comments with GitHub Permanent Links
It took me 8 years to realize the use of this simple tool with huge benefits that was in front of my eyes all the time.
A few months ago, I came across the Copy Git Link plugin in IntelliJ, which is a simple tool whose main functionality is to copy the GitHub permanent link with the line number of that code selected from IntelliJ IDE.
That's it. Now, you might wonder why anyone would create such a simple plugin and what is the use of it.
First, the important thing here is not the plugin itself, but the GitHub URL. I was not aware of this until one of the Senior Backend Developers in our team started using it in code review comments to point us to the exact API contract changes they had made in their GitHub repo.
That was the point when I realized how powerful sharing GitHub links can be. So let’s start.
1. Developer Onboarding
Whenever a new team member joins, the biggest challenge they face is understanding the codebase – identifying common patterns, existing components, and their locations within directories.
When the new developer creates their first PR, we can add a Git link to the relevant code as a code review comment.
For example, one member of our team created their own Circular Network Loading widget without realizing it already existed in the codebase. This happens because they are new and they were unaware of it. So, adding a Git link helps them to find the exact location of the widget.
2. Navigating Codebase
As you can see from the screenshot from the above section, all the author needs to do is click on the link, and they will land on the exact file with the line number defined in the link. From this GitHub URL, they can figure out in which folder this file exists, and then they can check that in their local code.
This navigation not only helps new developers but also the existing team. Sharing code snippets in code review discussions really helps to reach a conclusion faster.
This is where this plugin shines. Earlier, I used to find the classes manually on the GitHub repo webpage, which was slow and tedious. The plugin directly copies the link from the IDE, allowing me to use all IDE search features to search it code quickly.
3. Share Work In Progress
Sometimes, it often happens that you create a utility function or widget in your current work and while reviewing other team member’s PR, you may find that they have done the same thing or you have a better way of achieving the same.
Now, you can directly copy the URL from your current directory and share it with colleagues. (It should be committed and pushed to the origin, though).
If you are thinking of sharing new ideas or a solution to a problem with the team, you can do so in a separate commit and share the exact location of the suggested changes with the team.
Conclusion
All in all, this is just a simple tool that helps me a lot in better code review and sharing work. It's funny that it took me 8 years to realize that this was available all the time. It's just that I did not know how to use it, and most importantly, the benefit of it.
That's it, folks!!
If you have any questions, please let me know in the comments, and don't forget to subscribe to stay tuned for upcoming tips and tricks.
You can also follow me on Twitter for any updates.