Collaborating With Others -- Different Repositories ================================================================================= In order to collaborate using branches, everyone will need to have full read/write access to the GitHub repository. Sometimes it's not a great idea to grant another user that level of access, although you'd still like to be open to their contributions. GitHub provides that type of functionality through Forks. Forking -------------------------------- In this framework, one (or a few) users have ownership of all changes that will occur to the repository. A user outside of this core ownership group can contribute to a project by Forking (creating a copy of the repo in their own user space) and then making a cross-repository Pull Request (similar but not identical to the Pull Requests discussed in the prior section). * **Note**: Forking is similar to cloning - you are making a copy of a repository. However, your copy isn’t linked to the original repository. So edits that you make are pushed to the forked version in your own user space (https://github.com//Spoon-Knife) and look for a pull request button. .. image:: /_static/PullRequest.png :align: center :alt: PR When I hit pull request, I get a confirmation page with: 1. The two versions to be compared: the Octocat version (octocat:master) and my version (:master). Note that unlike the Pull Requests in the last section, cross-repository requests include the relevant repository names for additional clarity. 2. My commit history (right below the calendar). 3. The difference in index.html. Once I go ahead and hit "Create pull request" Octocat will get an email explaining that I made a change that I'd like him (or her?) to look at. He can go to the pull request to respond and comment if he has more questions. If he likes it, he can merge the change into his repository. Let's check out an example that someone has already sent Octocat. Because Spoon-Knife is a public repo, anybody can access and view this pull request. Note that iggykarpov is requesting that 1 commit be merged that changes 1 file. He provides a description of the proposed change explaining why it should be merged. Github notes that this PR has not conflicts and can be merged automatically. It also gives everyone an opportunity to comment on the changes. .. image:: /_static/PullRequest3.png :align: center :alt: PR3 To demonstrate how conversations can happen around a pull request let's look at a real-life example. You may have noticed that we have already viewed the repository for Apache Spark, a relatively new open-source project. People contribute to this project using the forking workflow we have described here and submitting pull requests. Here you can see a productive suggestion made at the end of the pull request at https://github.com/apache/spark/pull/14929 .. image:: /_static/PullRequest4.png :align: center :alt: PR4 This should give you a glimpse into the power of the "Hub" portion of Github for facilitating collaboration on code. If you ever need a quick review of this workflow, Github provides a nice summary: https://guides.github.com/activities/forking/