1

I am working for an project which has to do with GitHub API, I would like to make such a platform that users that are working on a repo specifically in one Branch in git and once they done with the issue they will do PULL REQUEST from Git, in other side I have a separate interface where I can see all Pull Requests sent by users on Git using the Git API.

I have made a separate interface in order when I accept the Pull Request I also want for example to trigger something else within that action, let say a payment.

I heard in these case they prefer to use Fork not Branches, What would you say is the best way for me to realize such things?

I have started this normally merging Branches so by using Branches, but the thing is that Git it allows everyone to merge branches, so that would break me the rules eventhou the trigger/payment wont trigger by merging branches from Git, only from the interface I have made, but still I wont wanna let the other users do merging branches.

Thank you

Nick Volynkin
  • 14,023
  • 6
  • 43
  • 67
Lulzim
  • 547
  • 4
  • 9
  • 22

1 Answers1

5

There's a rule: one repository should not be shared by two developers. This is why collaborators usually fork a parent repo and develop in their own fork.

A fork is just a repository with a link to another parent repository.

Collaborators can make a pull request from their fork to the original repo. A pull request is a commit or a series of commits (and never a whole repo). Pull requests are accepted from forks and not from branches of the same repo.

GitHub doesn't allow everyone to merge branches. Only the owner of a repo and users who were granted privileges may operate in a repo. You, as owner of the repo, will be able to accept a pull request. Don't just grant everybody with administration rights. Leave the right to operate branches of your repo to yourself and, maybe, a trusted hired professional.

If so, I dont see in Git Api how can I merge a fork with the original repo, do you know there is that API

This is how I do it. Sorry, not proficient with GitHub API.

enter image description here

Nick Volynkin
  • 14,023
  • 6
  • 43
  • 67
  • How a fork is related to a issue, I mean How can I track if by using forks track the issues. For ex: let say there is a issue #1 login create Do they need to create a branch, if user forks the repo? or just fork the current version and work only on that issue and make a Pull Request for that version of fork. Can you explain how Forks on Git works, and what are the differences from using Branches? – Lulzim May 20 '15 at 21:35
  • So do you think In my case I should consider using Fork, or Branches? – Lulzim May 20 '15 at 21:36
  • There's a rule: one repository should not be shared by two developers. – Nick Volynkin May 20 '15 at 21:39
  • Nick, Can you be more specific by that statement, I am confused If I choose to work with Fork or continue using Branches, well, I'v seen the Git Api and they dont have so much thing regarding mergin with Fork as they have using Branches? – Lulzim May 20 '15 at 21:45
  • So, you saying I have to use Forks?, If so, I dont see in Git Api how can I merge a fork with the original repo, do you know there is that API? – Lulzim May 20 '15 at 21:58
  • Does this Api works same as for branches also when a Pull Request is made from a fork? https://developer.github.com/v3/pulls/#list-pull-requests I mean Do I have the option to allow merge a commit sent from a fork? – Lulzim May 20 '15 at 22:08
  • If I decide to use Fork, Do i still need to use Branches for Pull Requests? – Lulzim May 20 '15 at 22:24
  • I've merged all my replies into the answer. – Nick Volynkin May 20 '15 at 22:48