Saturday, April 20, 2024
HomeHow ToHow to Perform Git Code Review

How to Perform Git Code Review

Summary: This article will demonstrate a code review workflow when using Git as a repository and Review Assistant as a code review tool. You will learn how to set up an effective code review process and useful features for code review that our tool provides.

Git is an open source version control system widely used among developers. Reviewing code before or after its commit can be quite important: your team can see what’s been changed, find any issues in the code and improve its quality.

Review Assistant allows you to smoothly perform code review and collaborate on the code.

Here we will give you a clear example and teach you how to use Review Assistant as a convenient code review tool for Git.

How to do a Git code review with Review Assistant

Review Assistant can be easily integrated with a Git repository for the project your team is working on now. So, you’ll get a possibility to optimize your code, fix bugs before the testing process begins and enhance your post-commit code review process in Git.

Let’s walk through the whole process together.

Adding a project to Azure DevOps repository

Getting a new repository and project set up is a simple and quick process:

  1. Create a new Git repository in Azure DevOps if you don’t have one. 
  2. Add a project and team members to it.
  3. Clone the repository to your local machine. 

Creating a project in Visual Studio

Now we will create a project in Visual Studio, which will be stored in the cloned repository.

We will create an ASP.NET Core application as an example and commit it to our repository in Azure DevOps.

Importing a project to Review Assistant

Now we need to add our project to Review Assistant in order to conduct and participate in a code review. Review Assistant provides a possibility to easily import a Git project from Azure DevOps:

1. Open the Review Assistant options.

2. Go to the Projects tab.

3. Click Import Projects From Team Foundation Server.

4. In the opened dialog, select Projects and Users.

5. The Select Projects to Import window opens where you select your Azure DevOps Server and check the project you want to import.

6. After import, unlike TFS, a Git repository should be manually configured. Review Assistant imports only a project name and project team members.

To manually set up a Git repository

1. On the Projects tab, select your project name in the list.

2. Click Add new repository.

3. In the Source control drop-down, select Git.

4. In the Repository directory field, click Browse and choose your repository location on your machine. The Display name field is filled in automatically.

5. Click Apply.

Besides importing a project, you can create a project by yourself and add a repository for it.

Creating a code review

We will describe a typical code review workflow when a developer makes changes to source code and a reviewer detects a defect in it.

For instance, a developer adds some code to an already-created controller, commits the changes to the repository and creates a code review for this commit.

To quickly create a code review in Review Assistant, do the following:

1. Open the Code Review Board by clicking the corresponding icon on the toolbar in Visual Studio.

2. Click the Create Regular Review button.

3. Click Add Revisions and select the revision you need. The review title and author are set automatically.

4. Select the reviewer and add the comments.

5. Click Create.

Performing a code review

Once a developer’s created a review, a reviewer sees it on the Code Review Board. In his turn, he checks a piece of code sent for a review and in case of a defect, writes a comment to fix it.

A developer fixes a bug, commits and pushes the changes, and then adds a commit to the review.

The reviewer checks the fix and completes the review.

To clearly see the changes and find the differences in the code, both a developer and a reviewer can use our powerful diff tool – Code Compare. It perfectly accompanies Review Assistant in the code review process.

Conclusion

In this article, we went through the best process for code review when working with a Git managed project. Integrating Review Assistant with Git can be quite beneficial, as you get live collaboration on your code improving its reliability.

To conduct an effective code review for Git, purchase and download Review Assistant already today!

RELATED ARTICLES

Whitepaper

Social

Topics

Products