-
Notifications
You must be signed in to change notification settings - Fork 0
/
R_Git_GitHub.Rpres
175 lines (129 loc) · 5.58 KB
/
R_Git_GitHub.Rpres
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<style>
.section .reveal .state-background {
background: white;}
.section .reveal h1,
.section .reveal p {
color: black;
position: relative;
top: 1%;}
</style>
<style>
.footer {
color: black; background: white;
position: fixed; top: 100%;
text-align:left; width:100%;
}
</style>
R is to RStudio as Git is to GitHub
========================================================
author: Cory Whitney (cory.whitney@uni-bonn.de)
font-family: 'Helvetica'
autosize: true
css: mySlideTemplate.css
<img src="R_Git_GitHub-figure/github.png" style="background:none; border:none; box-shadow:none;height="400"; width="400";"><img src="R_Git_GitHub-figure/INRES_Logo.png" style="background:none; border:none; box-shadow:none;height="100"; width="100";"><img src="R_Git_GitHub-figure/Uni_Bonn_Picture.png" style="background:none; border:none; box-shadow:none;height="200"; width="200";"><img src="R_Git_GitHub-figure/ZEF_Logo.png" style="background:none; border:none; box-shadow:none;height="200"; width="200";">
Automated version control
========================================================
incremental: true
**Never have I ever:**
- used 'cmd z' or 'ctrl z'
- came to the office but left the work at home on another machine or USB
- tried to co-author scripts by emailing files back and forth
<small>**Git** is an open source version control tool, **GitHub** is a company that hosts Git repositories in the web and provides a web interface to interact with repos they host.</small>
***
![](R_Git_GitHub-figure/final_doc_comic.png)
<div class="footer" style="margin-top;font-size:60%;">
https://swcarpentry.github.io/git-novice/guide </div>
Git: overview
========================================================
incremental: true
right: 80%
![](R_Git_GitHub-figure/git_logo.png)
<small>https://git-scm.com/</small>
***
A better way to:
- "undo" changes,
- collaborate than mailing files back and forth, and
- share code and other scientific work with the world.
```{r, out.width='35%', fig.align='center', echo=FALSE}
knitr::include_graphics('R_Git_GitHub-figure/git_logo_orange.png')
```
<div class="footer" style="margin-top;font-size:60%;">
<https://swcarpentry.github.io/git-novice/guide> </div>
GitHub: overview
========================================================
incremental: true
right: 80%
![](R_Git_GitHub-figure/octocat.png)
***
your local repository consists of three "trees" maintained by git. the first one is your `Working Directory` which holds the actual files. the second one is the `Index` which acts as a staging area and finally the `HEAD` which points to the last commit you've made.
***
```{r, fig.width=10, fig.height=5, fig.align='center', echo=FALSE}
knitr::include_graphics('R_Git_GitHub-figure/git_areas.jpg')
```
<div class="footer" style="margin-top;font-size:60%;"> http://rogerdudler.github.io/git-guide/ </div>
Git and GitHub: getting stuck
========================================================
incremental: true
right: 80%
![](R_Git_GitHub-figure/octocat.png)
***
- If you get stuck, just add “Git” to a search query e.g. a short description of your issue
- Someone else has also been confused by it and has written about it
- Thousands of talented programmers who scan the web and answer these problems
```{r, out.width='50%', fig.align='center', echo=FALSE}
knitr::include_graphics('R_Git_GitHub-figure/stack-overflow.png')
```
<div class="footer" style="margin-top;font-size:60%;">
https://stackoverflow.com/ </div>
Git and GitHub: basics
========================================================
incremental: true
right: 80%
![](R_Git_GitHub-figure/octocat.png)
***
Install Git & join Github (if you have not already):
- install Git
<small>https://git-scm.com/downloads</small>
- 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>
GitHub: host for your code
========================================================
incremental: true
right: 80%
![](R_Git_GitHub-figure/octocat.png)
***
**GitHub**
- a commercial website that lets you store repository publicly for free [get an education account with an uni email address](https://help.github.com/en/articles/applying-for-an-educator-or-researcher-discount)
- a friendly interface, no need to remember command line.
- useful features including issues, wikis etc.
```{r fig.width=10, fig.height=5, fig.align='center', echo=FALSE}
knitr::include_graphics('R_Git_GitHub-figure/Github-Icon-4.png')
```
GitHub: intro hello-world
========================================================
incremental: true
```{r, fig.width=10, fig.height=5, echo=FALSE}
knitr::include_graphics('R_Git_GitHub-figure/Hello_world.jpg')
```
<small>https://guides.github.com/activities/hello-world/</small>
Git: Command line
========================================================
incremental: true
right: 80%
![](R_Git_GitHub-figure/git_logo.png)
<small>https://git-scm.com/</small>
![](R_Git_GitHub-figure/git_logo_orange.png)
***
- `git reset --soft HEAD~1` or `commit SHA`
we undo our last commit, but the changes contained in that commit are not lost
- `git reset --hard HEAD~1` or `commit SHA`
we discard all changes we've made in the working directory
- `git stash`
move the waiting changes out of the queue
<div class="footer" style="margin-top;font-size:60%;">
https://jennybc.github.io/2014-05-12-ubc/ubc-r/session03_git.html </div>