generated from allisonhorst/meds-distill-template
-
Notifications
You must be signed in to change notification settings - Fork 10
/
day1-github_forking.qmd
45 lines (25 loc) · 2.24 KB
/
day1-github_forking.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
title: "Collaborative Coding Workflows: Forking"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
A **fork** is a **copy of a repository** that will be stored under your user account. Forking a repository allows you to freely experiment with changes without affecting the original project. We can create a fork on Github by clicking the "fork" button in the top right corner of our repository web page.
![](img/github-fork.png)
Most commonly, forks are used to either propose changes to someone else's project or to use someone else's project as a starting point for your own idea.
When you are satisfied with your work, you can initiate a ***Pull Request*** to initiate discussion about your modifications and requesting to integrate your changes to the main repository. Your commit history allows the original repository administrators to see exactly what changes would be merged if they accept your request. Do this by going to the original repository and clicking the "New pull request" button!
```{r, fig.align="center", echo=FALSE}
knitr::include_graphics("img/github-pull-request.png")
```
Next, click "compare across forks", and use the dropdown menus to select your fork as the "head fork" and the original repository as the "base fork".
![](img/github-compare-forks.png)
Then type a title and description for the changes you would like to make. By using GitHub's `@mention` syntax in your Pull Request message, you can ask for feedback from specific people or teams.
This workflow is recommended when you do not have push/write access to a repository, such as contributing to a open source software or R package, or if you are heavily changing a project.
## Demo time
Update the `greetings` R package to add the option to change the color of the background of the text.
Repo: <https://github.com/brunj7/greetings>
What I will do:
- Fork the repository
- Add functionality to this R package. In this example I will modify the `say_aloah()` function to allow changing the text background color to blue in addition to the existing green (see [here](https://github.com/r-lib/crayon#screenshot-on-osx) for more about the `crayon` package)
- Once done, I will create a Pull Request (PR) to integrate the new changes
- Merge back changes!