Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use collaboration on GitHub? So others can put their code without having access to the master branch?

Tags:

github

I am looking to collaborate with another person, but not able to figure out how GitHub works. I have a private repository, and I have added him as a collaborator, but now what?

  • Does he have to create a branch to which he will work separately?
  • How will the merge take place?
  • How will the merge take place? Who can merge the code?

PS - I saw the Stack Overflow question Do collaborators have commit access on GitHub? and looked at https://github.com/account/organizations/new, so basically unless I pay $25/month, can't I have someone not see the whole Master branch code?

like image 396
iCyborg Avatar asked Oct 06 '22 09:10

iCyborg


1 Answers

If you add your colleague as a collaborator to your repo (no need for organization), he will be able to push to your repo.
But he will push whatever he wants in any branch.
Unless he is pushing in his dedicated branch, that can be dangerous.

The other option is to ask him to fork your repo.

fork

See "What is the difference between origin and upstream in github".

By using pull requests, your colleague will ask for you to merge specific commits he wants to be taken into account.
But he will have his own GitHub repo to push to, which means he can push (or break) anything he wants.

like image 87
VonC Avatar answered Oct 10 '22 03:10

VonC