Last week we looked at better ways of contributing to a repository on GitHub when you are a collaborator. This may not always be the case. Often times, development of open source software is brought about by contributions from active users who are not official collaborators on a project.
Take any popular R package on GitHub and look at how many people contributed code towards continuing development of that project. Chances are that many of them are not official collaborators. This week, we will learn how to contribute on github in such circumstances using forks.
purrr
.Take a look at the top right corner on the package page. You will see something like above. This indicates how many people are watching the repo for updates (watch + star) and how many have forked the repository for further development.
Assuming you are currently logged into your account on github, click on the Fork
button on the purrr repo. Notice that GitHub will transfer you to your own account where a copy of the purrr repository will be created. It will appear as follows:
penguin
creates a new repoFirst, using your original account, create a new repo, and name it mkhist
. Keep it public.
Unlike last week, you will not create any collaborators on this repo.
penguin
creates a R packageREADME.md
.library(tidyverse)
mkhist <- function(x){
print(x %>% head())
x %>% gather() %>% head()
ggplot(gather(x), aes(value)) +
geom_histogram(bins=20) +
facet_wrap(~key, scales='free_x')
}
penguin
pushes the package to githubpuffin
installs the packagepuffin
forks the package repositorypuffin
sets up repo for contributionpuffin
adds more functionality to the packagepuffin
pushes updates to the forkpuffin
creates a pull requestpenguin
examines and resolves the pull request