-
Notifications
You must be signed in to change notification settings - Fork 5
/
Seminar_05_Git_Github.Rmd
60 lines (32 loc) · 3.65 KB
/
Seminar_05_Git_Github.Rmd
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
## Seminar 5: Using git and Github {#github_git}
<!-- [Using git and Github](#github_git) -->
Welcome to the fourth seminar of **Decision Analysis and Forecasting for Agricultural Development**. All your programming and project work for this course should take place in the git environment and this seminar is intended to show you how to make that happen. Feel free to bring up any questions or concerns in the Slack or to [Dr. Cory Whitney](mailto:[email protected]?subject=[Seminar_4]%20Decision%20Analysis%20Lecture) or the course tutor.
### Git and Github
Now we look at the programming version control environment [git](https://git-scm.com/) and the interface [github](https://github.com/), which we use to share our scripts and changes to our work.
<iframe width="560" height="315" src="https://www.youtube.com/embed/S98XJTyIVaY" frameborder="0" allowfullscreen></iframe>
Install Git & join Github (if you have not already):
- install Git
<small>https://git-scm.com/downloads</small>
**Important note for Windows users**: when you download Git, it may be installed into your `Program Files` directory by default. This often causes issues later. The general recommendation is to choose a different directory for installing, i.e. `C:/Users/username/bin/`. Once Git is installed, open RStudio, and go to `Tools > Global Options`, select `Git/SVN`, and then enter or select the path for your Git executable.
- **join Github**
<small>https://github.com/</small>
Some useful tips on getting these running from our friends
- **University of Zurich**
<small>http://www.geo.uzh.ch/microsite/reproducible_research/post/rr-rstudio-git/</small>
- **Nathan Stephens**, a very helpful R blogger
<small>https://support.rstudio.com/hc/en-us/articles/200532077-Version-Control-with-Git-and-SVN</small>
- **R For the Rest of us** Learn the essentials of using Git and GitHub with RStudio. This guide explains how to integrate version control into your R projects for better collaboration. <https://rfortherestofus.com/2021/02/how-to-use-git-github-with-r/>
Start simple with your own repository only and work on it alone. Share your profile and link to a repository you made in the Slack channel for this seminar. Soon you will start to collaborate on something in git. For the project part of this course your team will work in a collective repository and work together to generate the final working project model and report.
### Bonus: Sharing html files
We can use the options from `htmlpreview.github.io` to show the results of any of our html output work that is stored in our git repository.
To do that just preface the path for the html file with `http://htmlpreview.github.io/?`.
For example the slides for this seminar can be found in the `CWWhitney/teaching_git` repository.
The full path is: `https://github.com/CWWhitney/teaching_git/blob/master/R_Git_GitHub.html`
and the link to this to be viewed directly as a web page is: http://htmlpreview.github.io/?https://github.com/CWWhitney/teaching_git/blob/master/R_Git_GitHub.html
### Bonus: Further Reading
- [Happy Git with R by Jenny Bryan](https://happygitwithr.com/)
- [Best practices in git from datree.io](https://www.datree.io/resources/github-best-practices)
- [Best practices for using Git from deepsource.io](https://deepsource.io/blog/git-best-practices/). Note that we break rule number five when we share the html files in the Git repository. That can be our secret.
- [Git game for learning about branch management](https://learngitbranching.js.org/)
Watch the 'What is GitHub' video from the GitHub developers
<iframe width="560" height="315" src="https://www.youtube.com/embed/w3jLJU7DT5E" frameborder="0" allowfullscreen></iframe>