3

I have a repository that I have developed over a period of time. It includes a series of files that I would like to get peer-reviewed via Pull-request. One pull-request for each file in this repo will be exactly what I need.

In the past, I have initiated code-reviews for new pieces of code or the suggested changes and modification on the existing code. However, I never been in a situation that I wanted to get all the files that are already in the repository to get reviewed.

One way that I tried was removing files from master branch, and make a pull-request when I try to push them again from another branch (forked/cloned from the origin/master). But, I am not sure if this is the best way to do this.

What is the best way to code-review existing code?

Rotail
  • 1,025
  • 4
  • 19
  • 40
  • Your described process (1 file per PR) doesn't seem practical to me. It uses git in a way it has clearly not been designed to, and the "changes" in your "pull requests" don't represent changes at all. But beyond that, how are you supposed to review a *lone* file? Files in a codebase are almost always related to each other and it makes little to no sense to isolate code review in this way. Reviewing *only* the CSS file but not the HTML it applies to? I might miss something in the picture, but I personally don't get the point so far. – Romain Valeri Apr 11 '19 at 20:25
  • @RomainValeri the reason for file-by-file review is that in this specific repo each file is 100% independent of all others. – Rotail Apr 12 '19 at 13:19
  • Yes, in this context it could make much more sense. – Romain Valeri Apr 12 '19 at 13:23

1 Answers1

0

For existing code, as illustrated in "Recipe: code reviews for existing code with GitHub", the PR would include all the files, not just one file at a time.

Example: thibaudcolas/react-streamfield PR 1.

Once the PR is in place, you can leave comments file by file, as shown in this review pullrequestreview.

See "Commenting on a pull request"

https://help.github.com/assets/images/help/commits/hover-comment-icon.gif

That can be done for each file individually.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I do not see this "plus" sign when I roll over my cursor on the lines with no change. I have a snapshot of it. But it seems images cannot be posted in comments. – Rotail Apr 12 '19 at 13:15
  • I found my cursor can edit *3 lines* above and below the changed area. – Rotail Apr 12 '19 at 13:25
  • @Rotail the doc mentions "After you open a pull request in a repository, collaborators or team members can comment on the comparison of files between the two specified branches, or leave general comments on the project as a whole." Make sure you have the correct right. And that you are trying on the comparaison view ("Files Changed"). – VonC Apr 12 '19 at 13:38