1

Suppose C(=Coder) and S(=Supervisor) are working on a project. For some reasons S never contributes to the codes and just comments on the code. Instead C is the only person coding. Is it possible to send pull request by C to be reviewed by S, within one project, or they essentially need to have two projects (or two branches)?

Note: the question is about github and, possibly git in general.

Daniel
  • 5,839
  • 9
  • 46
  • 85

2 Answers2

2

Yes.

You can create pull request for separate branches of the same repository. C just needs to make sure to push their changes on a separate branch then, so that they can create a pull request from it to the master branch of the project. But yeah, this is totally possible, and many projects actually do pull requests within the same repository for code reviewing purposes.

poke
  • 369,085
  • 72
  • 557
  • 602
0

In addition to @poke's answer: Yes, this is possible.

However, depending on how disciplined C is, a typical requirement in a code review scenario would be to restrict access to the master branch to S. Usually, you would

  1. either trust C to push all changes into feature branches and use pull requests (although he could push directly into the master branch, bypassing code review), or
  2. use ACLs of some kind to programatically prevent access to the master branch, and grant only S the privilege to merge pull requests into this branch.

On GitHub, when you have write access to a repository, you have access to all branches, so you'd have to trust C to actually use pull requests (this has actually been discussed in other questions). Other Git hosting software does provide this kind of branch-level ACLs (I know of BitBucket, and if memory serves also Gitlab).

Community
  • 1
  • 1
helmbert
  • 35,797
  • 13
  • 82
  • 95