How to effectively review pull request (PR) directly in Android Studio
Recently, I came across the below tweet: This tweet caught my attention and I was thinking that day how can I improve my code review process apart from looking at pull request on the web page. Sometime you need to dive deep to understand the logic effectively. And I think one of the best ways to review the code base is directly inside the IDEA you are using. As we all know Android Studio has nice git tools embedded in it. So why not we utilize it. In Android Studio you can find Git tab as shown below: You should easily recognize it as it normally the place where you can see the non committed changes you have made on top of current branch you are in. It is quite nice window tool as it shows all the changes made with different colors. Like deleted files in red, added files in green, or simple changes in the existing file in blue. So it's relatively effective to navigate and compare changes quickly without a hassle. Remember, being an 10x developer means effectively using tools available. So what we can do is to switch to the branch where current PR is targeting to and then execute below git command:
git merge --no-commit --squash <pr branch>
And then you will see all the changes applied in the git window. Just like when you make changes in your branch before committing. On top of it you can build the project and tweak the code a bit. Basically play around with the changes. I think that's a really good way of reviewing the code when you really keen to understand every piece of the change made.
And to revert the changes, simply execute below git command:
git reset --hard
.
Conclusion is you can choose whatever way works for you the best when reviewing PR. I found above technique works for me the best when I want to make sure nothing slips out of attention.