- fork - make a copy of a remote repo on GitHub from one account to another.
- pull request - ask the upstream maintainer to pull in changes from origin.
- upstream - the name for a remote read-only repository
- origin - the name for a remote read-and-write repository
- Branching is a feature of Git, you've used branching already
- Forking is a feature of GitHub
- A fork is a personal copy of another user's repository that lives on your account. Forks allow you to freely make changes to a project without affecting the original. Forks remain attached to the original, allowing you to submit a pull request to the original's author to update with your changes. You can also keep your fork up to date by pulling in updates from the original. - GitHub Glossary
- When you fork a repository, you get all of the branches the other person posted on GitHub
- Pull requests however, don't acknowledge forks since they are a feature of GitHub and not Git. So while you can colloquially say "I'm issuing a pull request from my fork to yours", really what you're saying is "I'm issuing a pull request from the master branch of my fork to the master branch of your fork". You can actually issue a pull request from any branch in your forked repository to any branch in the original repository.
Here is a good example repository that makes use of issues and pull requests: https://github.com/openelections/
-
Step 1: Fork my repository
dmil/simple-website
. -
Go to Settings > GitHub Pages and select the "master" branch as the source. Wait a few seconds and then go to http://
your-username
.github.io/simple-website to make sure github pages is set up correctly. -
Normally I'd clone the forked repository locally onto my computer, push changes to the fork, then issue a pull request. For the sake of time lets cut that step out. Make one small edit in your fork of this code directly in GitHub.
-
Create a pull request. Note that this time we are creating pull request across repositories instead of just across branches within the same repository. The
base
will bedmil/simple-website/master
while thecompare
will beyour-username/simple-website/master
. -
Compare your website http://
your-username
.github.io/simple-website to mine: http://dhrumilmehta.com/simple-website/ -
I will now merge your pull requests and we can see what changes you all make to the website over time. There's a good chance we may run into some merge conflicts as well.
-
Step 1: Fork my repository
dmil/simple-website
. -
Go to Settings > GitHub Pages and select the "master" branch as the source. Wait a few seconds and then go to http://
your-username
.github.io/simple-website to make sure github pages is set up correctly. -
Clone the forked repository to your Development folder.
git clone [email protected]:XXXX/XXXX.git
-
Create a feature branch with your name.
git checkout -b <your name>
-
Make a random change.
-
Commit and push the change.
git commit -m "describe your random change here" git push
-
Create a pull request. Note that this time we are creating pull request across repositories instead of just across branches within the same repository. The
base
will bedmil/simple-website/master
while thecompare
will beyour-username/simple-website/feature-branch-name
. -
Create another pull request within the fork itself where the base is your own master branch. More explicitly, the base is
your-username/simple-website/master
and the compare isyour-username/simple-website/feature-branch-name
. Merge this pull request.Note: Draw diagram on board
-
Compare your website http://
your-username
.github.io/simple-website to mine: http://dhrumilmehta.com/simple-website/ -
I will now merge your pull requests and we can see what changes you all make to the website over time. There's a good chance we may run into some merge conflicts as well.
Open source collaboration is great for:
- Not duplicating work
- Collaborating accross organizations
- Interacting with people - sometimes making an issue or a pull request can lead to friendship (or sources or collaborators)
- Reader feedback
- Collective debugging, finding critical errors faster (often also leads to better security and better data quality).
- Building upon someone else's project
- Feuding
- Philosophical Reasons
- Being nerdy?
More Links
- Find another partner, and fork their
<username>-simple-website
. - Clone your fork onto your local computer and create a feature branch called
endorsement
. - Put an endorsement on their webpage as the last item on the site.
<h2> Endorsements </h2> <p> You are a really cool person. - Dhrumil</p>
- Commit this endorsement and push it to your fork..
- Issue a pull request back to that person's github repo.
Make an issue on my simple-website repository: https://github.com/dmil/simple-website