generated from inSilecoInc/workshop_R_template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
_01_overview.Rmd
567 lines (308 loc) · 9.56 KB
/
_01_overview.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
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
---
title: "Overview"
output:
xaringan::moon_reader:
css: [default, rd.css, rd-font.css, "hygge"]
lib_dir: assets
seal: false
nature:
highlightStyle: dracula
countIncrementalSlides: false
beforeInit: "macros.js"
---
# Overview
```{r setup_01, include = FALSE}
source("_setup.R")
# knitr::clean_cache(TRUE)
htmltools::tagList(
xaringanExtra::use_clipboard(
button_text = "<i class=\"fa fa-clipboard\"></i>",
success_text = "<i class=\"fa fa-check\" style=\"color: #37abc8\"></i>",
),
rmarkdown::html_dependency_font_awesome()
)
xaringanExtra::use_scribble()
```
---
# In this part, we will...
--
## learn what are `r gt()`, `r gh()` and `r gl()`;
--
## get a basic understanding of how `r gt()` works.
---
# Key resources
.center[![:scale 30%](https://git-scm.com/images/progit2.png)]
- `r lk()` S. Chacon & B. Straub (2014), Pro Git https://git-scm.com/book/en/v2
- `r gh()` https://github.com/progit/progit2
- `r bk()` https://github.com/progit/progit2/releases/tag/2.1.336
---
# Key resources
.center[![:scale 90%](img/part1/happygit.png)]
- `r lk()` J. Bryan (2022), Happy git with R https://happygitwithr.com/
---
# Key resources
.center[![:scale 30%](img/part1/so_cover.jpeg)]
- `r lk()` https://tra38.gitbooks.io/essential-copying-and-pasting-from-stack-overflow/content/
- `r so()` https://stackoverflow.com/
---
class: inverse, center, middle
# Genesis
![:custom_hr]()
## The genesis of `r gt()`
---
# Genesis
### - 2005 Linux Kernel developers needed a new tool to replace [BitKeeper](https://en.wikipedia.org/wiki/BitKeeper)
--
### - Linus Torvald and colleagues start developing a new tool called `r gt()`
--
### - 01/2006 version 1.0
--
### - 2009 `r ar()` [Junio C. Hanamo (@gitster)](https://github.com/gitster) became the lead developer
--
### - 05/2014 version 2.0
--
### - 11/2021 version 2.34
---
# Genesis
.center[![](img/part1/linux.png)]
- `r lk()` https://github.com/torvalds/linux
---
# Genesis
.center[![](img/part1/git.png)]
- `r lk()` https://github.com/git/git
---
# Genesis
### What does `r gt()` actually mean?
.center[![](img/part1/name.png)]
- `r lk()` https://git.wiki.kernel.org/index.php/Git_FAQ#Why_the_.27Git.27_name.3F
---
# Genesis
### `r gt()` is a version control system
--
### `r gt()` was designed around several goals
1. Speed
1. Simple design
1. Strong support for non-linear development (thousands of parallel branches)
1. Able to handle large projects like the Linux kernel efficiently (speed and data size)
1. **Fully distributed**
<br>
- `r lk()` S. Chacon & B. Straub (2014), [Pro Git](https://git-scm.com/book/en/v2)
---
class: inverse, center, middle
# DVCS
![:custom_hr]()
## `r gt()` is a distributed version control system
---
# Version Control Systems (VCS)
.center[![:scale 50%](img/part1/vcs.png)]
<br>
- `r lk()` S. Chacon & B. Straub (2014), [Pro Git](https://git-scm.com/book/en/v2).
---
# Centralized Version Control Systems (CVCS)
.center[![:scale 80%](img/part1/cvcs.png)]
- `r lk()` S. Chacon & B. Straub (2014), [Pro Git](https://git-scm.com/book/en/v2).
---
# Distributed Version Control Systems (DVCS)
.center[![:scale 40%](img/part1/dvcs.png)]
- `r lk()` S. Chacon & B. Straub (2014), [Pro Git](https://git-scm.com/book/en/v2).
---
# `r gt()` is fully distributed
## Every repository includes the entire database
--
## database = `r emj("file_folder")` `.git`
--
```sh
$ tree -a -L 1
.
├── _01_git_github.Rmd
├── _02_basic_git_actions.Rmd
├── _03_beyond_pppp.Rmd
├── _04_rmarkdown.Rmd
├── _05_csas.Rmd
├── DESCRIPTION
├── .git
├── .github
├── .gitignore
```
--
## `.git` is what we share!
---
class: inverse, center, middle
# Snapshots
![:custom_hr]()
## `r gt()` stores snapshots of your file system
---
# How does `r gt()` work?
## What does `r emj("file_folder")` `.git` include?
### `.git` stores **snapshots**
.center[![:scale 100%](img/part1/snap.png)]
---
# How does `r gt()` work?
## What does `r emj("file_folder")` `.git` include?
### `.git` stores **snapshots** not deltas!
.center[![:scale 100%](img/part1/delta.png)]
---
# **snapshots**?
.center[![:scale 100%](img/part1/sp_1.png)]
---
# **snapshots**?
.center[![:scale 100%](img/part1/sp_2.png)]
---
# **snapshots**?
.center[![:scale 100%](img/part1/sp_3.png)]
---
# **snapshots**?
.center[![:scale 100%](img/part1/sp_4.png)]
---
# **snapshots**?
.center[![:scale 100%](img/part1/sp_5.png)]
---
# **snapshots**?
.center[![:scale 100%](img/part1/sp_6.png)]
---
# **snapshots**?
.center[![:scale 100%](img/part1/sp_7.png)]
---
# How do I create snapshots?
### 1. Initiate the repository (`git init`)
--
### 2. Edit your files
--
### 3. Stage the modifications to be committed (`git add`)
--
### 4. Create a new commit object (`git commit`)
--
### 5. Go back to step 2.
---
# How does `r gt()` work?
.center[![:scale 100%](img/part1/sp_3.png)]
---
# How does `r gt()` work?
.center[![:scale 100%](img/part1/sp_8.png)]
---
# How does `r gt()` work?
.center[![:scale 100%](img/part1/sp_9.png)]
---
class: inverse, center, middle
# Share your .git database
![:custom_hr]()
## `r gh()` & `r gl()`
---
# Setting and using a remote repository
### 1. Go to a server;
--
### 2. Initiate a bare repository (`git init --bare --shared`);
--
### 3. Add the remote to your local repository (`git remote add <name> <adr>`);
--
### 4. Sync your local repository and your remote one (using `git pull` and `git push`).
<br>
- `r lk()` S. Chacon & B. Straub (2014), [Pro Git](https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols).
---
# `r gt()` servers
## Your own server
- e.g. a minimal ssh server (see [this post](https://kevcaz.insileco.io/notes/git/git_server_ssh/))
--
## Your own fully-featured server
- [GitLab](https://gitlab.com/)
--
## Dedicated hosting server
- [GitHub](https://github.com/)
- [GitLab](https://gitlab.com/)
- [Bitbucket](https://bitbucket.org/)
- ...
---
# GitHub `r gh()`
> GitHub, Inc. is a provider of Internet hosting for software development and version control using Git. It offers the distributed version control and source code management (SCM) functionality of Git, plus its own features. https://en.wikipedia.org/wiki/GitHub
--
- Git server + database-backed website
- `r rfa("plus")` [Web REST API](https://docs.github.com/en/rest)
- `r rfa("plus")` [Issue tracking system](https://en.wikipedia.org/wiki/Issue_tracking_system)
- `r rfa("plus")` [Project management features](https://github.com/features/issues)
- `r rfa("plus")` Host webpages ([GitHub Pages](https://pages.github.com/))
- `r rfa("plus")` Continuous Integration ([GitHub Actions](https://docs.github.com/en/actions))
- `r rfa("plus")` ...
--
### GitHub in numbers https://octoverse.github.com/
---
# GitLab `r gl()`
- Git server + database-backed website
- `r rfa("plus")` [Web REST API](https://docs.gitlab.com/ee/api/)
- `r rfa("plus")` Issue tracking system
- `r rfa("plus")` Project management features
- `r rfa("plus")` Host webpages ([GitLab Pages](https://docs.gitlab.com/ee/user/project/pages))
- `r rfa("plus")` Continuous Integration ([Gitlab CI/CD](https://docs.gitlab.com/ee/ci/))
- `r rfa("plus")` ...
--
### GitLab in numbers https://about.gitlab.com/company/
--
### You can install your own `r gl()` server https://about.gitlab.com/install/
---
class: inverse, center, middle
# Use .git!
![:custom_hr]()
---
# Install `r gt()`
A lot of tutorials!
- https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
- https://happygitwithr.com/install-git.html
- https://github.com/git-guides/install-git
--
```{bash}
git --version
```
---
# Interact with `r gt()`
### **Command lines**
- **Terminal**
- [RStudio](https://support.rstudio.com/hc/en-us/articles/200532077-Version-Control-with-Git-and-SVN)
- with R, see [`gert`](https://CRAN.R-project.org/package=gert)
--
### More interactively
- [Sourcetree](https://www.sourcetreeapp.com/)
- [GitHub Desktop](https://desktop.github.com/)
- [Git Kraken](https://www.gitkraken.com/)
- Code editors
- [Visual Studio](https://docs.microsoft.com/en-us/visualstudio/version-control/git-with-visual-studio?view=vs-2022)
- ...
---
# Get started with GitHub or GitLab
## GitHub `r gh()`
- Sign up on https://github.com, then go to https://docs.github.com/en/get-started
## GitLab `r gl()`
- Go to https://about.gitlab.com/get-started/
---
# `r lc()` demo
### Assuming you have one `r gh()` account and `r gt()` installed;
### We will do it again next week.
<!-- first local then add remote -->
???
terminal install
github open
Terminal Rstudio open
---
class: inverse, center, middle
# tl;dr
![:custom_hr]()
---
# `r gt()`...
### is a distributed version control system.
--
### stores snapshots of files called commits that are stored in the `.git` folder.
--
### makes collaboration easy by allowing sharing and synchronizing `.git` folder between local and remote repositories.
---
# Resources
### Books
- S. Chacon & B. Straub (2014), [Pro Git](https://git-scm.com/book/en/v2)
- J. Bryan (2022), [Happy git with R](https://happygitwithr.com/)
### Websites
- https://git.wiki.kernel.org/index.php/Main_Page
- https://mirrors.edge.kernel.org/pub/software/scm/git/docs/user-manual.html
- https://learngitbranching.js.org/
- Github: https://docs.github.com/en
- GitLab: https://docs.gitlab.com/ee/topics/git/#git
### Cheat sheets
- https://ndpsoftware.com/git-cheatsheet.html#loc=workspace `r emj("fireworks")`
- https://education.github.com/git-cheat-sheet-education.pdf
- https://www.freecodecamp.org/news/git-cheat-sheet/