-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from cct-datascience/github-slides
WIP: draft lesson 5 slides
- Loading branch information
Showing
12 changed files
with
197 additions
and
6 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
@article{bryan2018, | ||
title = {Excuse me, do you have a moment to talk about version control?}, | ||
author = {Bryan, Jennifer}, | ||
year = {2018}, | ||
month = {01}, | ||
date = {2018-01}, | ||
journal = {The American Statistician}, | ||
pages = {20{\textendash}27}, | ||
volume = {72}, | ||
number = {1}, | ||
doi = {10.1080/00031305.2017.1399928}, | ||
url = {https://www.tandfonline.com/doi/full/10.1080/00031305.2017.1399928}, | ||
note = {Publisher: Taylor & Francis} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
--- | ||
title: "Collaborate With GitHub" | ||
subtitle: "Session 5" | ||
format: revealjs | ||
editor: visual | ||
chalkboard: true | ||
footer: "[Reproduciblity & Data Science in R](../../index.html)" | ||
bibliography: references.bib | ||
--- | ||
|
||
## Review | ||
|
||
::: callout-note | ||
## Word Bank | ||
|
||
repo \| commit \| remote \| push \| pull \| add | ||
::: | ||
|
||
::: incremental | ||
1. A collection of files tracked by git | ||
2. A snapshot of the state of a repository | ||
3. `git` \_\_\_ is used to tell git to track a file | ||
4. For example, a repo on GitHub | ||
5. `git` *\_\_\_\_* is used to synchronize changes on your computer with a remote | ||
::: | ||
|
||
## Homework | ||
|
||
Did anyone add a repo to GitHub? | ||
What difficulties did you encounter? | ||
|
||
## Collaborating with GitHub | ||
|
||
![](github-diagram-bryan.png){fig-align="center" width="671"} | ||
|
||
::: aside | ||
Figure 2 from [@bryan2018] | ||
::: | ||
|
||
::: notes | ||
A GitHub repo can be used to coordinate collaboration | ||
|
||
If two people have permissions, both can push changes to the repo | ||
|
||
Ask for a volunteer and give them permission to push to a repo | ||
::: | ||
|
||
## Example repo | ||
|
||
- Everyone practice cloning this example repo as a new RStudio project: <!--# TODO: add link --> | ||
|
||
- Need one volunteer to edit the README.md and practice commit + push | ||
|
||
## Dealing with Conflicts | ||
|
||
- What happens when two people make conflicting edits to a file and push them? | ||
|
||
- Creates a *merge conflict* | ||
|
||
![](push_error.png) | ||
|
||
## Ok, try `git pull` | ||
|
||
![](pull_error.png) | ||
|
||
## Merge, rebase, fast-forward?? | ||
|
||
- These are alternative ways to deal with conflicts---we won't get into the deatils | ||
|
||
- For now, we recommend you stick with the "merge" option | ||
|
||
. . . | ||
|
||
Use: | ||
|
||
``` bash | ||
git config pull.rebase false | ||
``` | ||
|
||
Or, if you want to set this option for all future repos too | ||
|
||
``` bash | ||
git config --global pull.rebase false | ||
``` | ||
|
||
## Fixing a Merge Conflict | ||
|
||
![](merge_conflict.png) | ||
|
||
- Resolve the conflict however you want (i.e. keep one of the two sections) | ||
|
||
- Delete all lines with `<<<<<<<`, `>>>>>>>`, or `=======` | ||
|
||
- Save and commit | ||
|
||
::: notes | ||
Let's have a round of applause for our volunteer! | ||
::: | ||
|
||
## Avoid merge conflicts by working on branches | ||
|
||
Each person works on a "branch"---an independent series of commits that can be merged back into the "main" branch. | ||
|
||
```{mermaid} | ||
gitGraph | ||
commit | ||
commit | ||
branch person_1 | ||
commit | ||
commit | ||
commit | ||
checkout main | ||
branch person_2 | ||
commit | ||
commit | ||
checkout main | ||
merge person_1 | ||
merge person_2 | ||
commit | ||
``` | ||
|
||
## Working on a Branch | ||
|
||
- Make a new branch with your name using RStudio's Git pane | ||
|
||
- Commit changes and push to your branch | ||
|
||
- View changes on GitHub | ||
|
||
## Pull Requests | ||
|
||
A request to merge changes into the main branch | ||
|
||
- Need another volunteer to share screen and be guided through making a pull request | ||
|
||
- This time, everyone can follow along! | ||
|
||
## Forks {.smaller} | ||
|
||
::: columns | ||
::: {.column width="40%"} | ||
What if you don't have permission to push to a GitHub repo but you want to contribute? | ||
Make a fork! | ||
|
||
![](fork_btn.png){fig-align="center"} | ||
::: | ||
|
||
::: {.column width="60%"} | ||
|
||
![](fork_diagram.png){fig-align="center" width="627"} | ||
::: | ||
::: | ||
|
||
## Collaborating with Forks | ||
|
||
To contribute to a repo you don't have push permission for: | ||
|
||
1. **Fork** the repo to your own GitHub | ||
2. **Clone** the fork to your local computer | ||
3. Make **commits** (ideally on a **branch**) | ||
4. Make a **pull request** to the upstream repo | ||
|
||
::: callout-tip | ||
## Exercise | ||
|
||
In pairs, practice this workflow to make a PR to our example repo | ||
::: | ||
|
||
## References | ||
|
||
::: refs | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters