This document assumes that you have a GitHub account. Suppose you want to contribute code to a particular GitHub maintained project (we will use the BSDA project as an example).
Project. (Walk through in class)To create a branch open a shell and type:
git checkout -b newbranch-name
After issuing the last command with the newbranch_name (names should be in lowercase letters and numbers, with - used to separate words), make changes as normal. Note that the push/pull icons in RStudio are disabled. To enable them, you will first need to tell GitHub that your local branch has a remote equivalent by using the following:
git push --set-upstream origin newbranch-name
You should now be able to push any commits to your remote branch. In this document, GitHub user susiearnholt created the branch patch4 and pushed changes to her remote branch on GitHub.
master - we want patch4)Make sure the Branch:master is even with alanarnholt:master. (See below)
Click Compare & pull request
Create pull requestBSDA uses Travis-CI. The result is shown below.Merge pull request button if the changes are approved. Note that GitHub will ask you to confirm the merge before the transaction is complete.Once a pull request is honored, your fork and branches will be out of sync with the owners. To sync your branches and fork, open a shell and type the following:
git remote add upstream <owner repo.git>
For this exercise, the repository of interest is https://github.com/alanarnholt/BSDA.git.
git remote add upstream https://github.com/alanarnholt/BSDA.git
git pull upstream master
At this point, you should click pull then push. Your branch should be even with the owners. Follow the same process to get the forked master in sync with the owner/master.