-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRLadies-gitGithub.html
738 lines (447 loc) · 13.7 KB
/
RLadies-gitGithub.html
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
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
<!DOCTYPE html>
<html>
<head>
<title>R-Ladies Montpellier</title>
<meta charset="utf-8">
<meta name="author" content="Criscely Luján" />
<meta name="date" content="2019-02-12" />
<link href="libs/remark-css/default.css" rel="stylesheet" />
<link href="libs/remark-css/rladies.css" rel="stylesheet" />
<link href="libs/remark-css/rladies-fonts.css" rel="stylesheet" />
</head>
<body>
<textarea id="source">
class: center, middle, inverse, title-slide
# R-Ladies Montpellier
## Version control with GITHUB
### Criscely Luján
### February 12, 2019
---
class: inverse, center, middle
# Keep in touch
<a href="mailto:[email protected]"><i class="fa fa-paper-plane fa-fw"></i>&nbsp;Personal email: [email protected]</a><br>
<a href="mailto:[email protected]"><i class="fa fa-paper-plane fa-fw"></i>&nbsp; Profesional email: [email protected]</a><br>
<a href="http://twitter.com/CriscelyLP"><i class="fa fa-twitter fa-fw"></i>&nbsp; Twitter: @CriscelyLP</a><br>
<a href="http://github.com/CriscelyLP"><i class="fa fa-github fa-fw"></i>&nbsp; GitHub: @CriscelyLP</a><br>
---
background-image: url("https://media.giphy.com/media/3oD3YveOJWdwIAfZ5e/giphy.gif")
background-position: 50% 60%
class: center, inverse
background-size: 700px
# Get start! YEAH!
---
# Why is important version control?
<div class="figure" style="text-align: center">
<img src="img/phd_comics.png" alt="phdcomics.com" width="350px" />
<p class="caption">phdcomics.com</p>
</div>
---
# Why is important version control?
--
The version control is important for:
<br>
--
- Storing version (properly)
<br>
--
- Restoring previous versions
<br>
--
- Collaborations
<br>
--
- Save time!
<br>
---
# Version control software
--
<div class="figure" style="text-align: center">
<img src="img/controlVersion.png" alt="Wikipedia" width="1000px" />
<p class="caption">Wikipedia</p>
</div>
---
# Why git?
--
Git is a distributed version-control system for tracking changes in source code during the development of software.
--
<br>
<br>
<br>
<img src="img/git_logo.png" width="500px" style="display: block; margin: auto;" />
---
# Why git?
--
- Distributed
- Work online or offline
- Collaborate with large groups
--
- Popular and Successful
- Active development
- Shiny new tools
- Fast
--
- Tracks any type of file
- Works best with text
--
- Branching
- Smarter merges
--
<br>
<br>
**Slide taken from [Mine Cetinkaya-Rundel](http://rpubs.com/mine/rladies-git)**.
---
# GitHub Inc.
--
A web-based hosting service for version control using Git.
[GitHub](https://github.com/)
<br>
<br>
<img src="img/github_logos.png" width="900px" style="display: block; margin: auto;" />
---
# GitHub Inc.
- Access to the control and collaboration features for every `project`.
<br>
--
- Work with public and private `repositories`.
<br>
--
- Develop a `networking`.
<br>
--
- `Plans` for enterprise, teams, pro and free accounts.
<br>
--
- Is the `largest host of source code` in the wordl! (28 million users and 57 million repositories until June 2018).
---
# Register a GitHub account
--
- Register an account with [GitHub](https://github.com/) is free!
<br>
--
- Free private repos
- Students, faculty, and educational/research staff: [GitHub Education](https://education.github.com/)
- Official nonprofit organizations and charities: [GitHub for Good](https://github.com/nonprofit)
<br>
--
- Pay for private repos
- $7/month: [GitHub Pricing](https://github.com/pricing)
<br>
--
- Tips about the name acount:
- Use your actual name!
- Shorter is better than longer!
- Be as unique as possible!
- Reuse your name from other context, e.g. `Twitter` or `Slack`!
---
# Git is already installed?
--
To check that go to shell (terminal / command line / console) and enter `which git` to request the path to your Git executable:
--
```bash
which git
```
```
## /usr/bin/git
```
--
<br>
Then enter `git --version` to see its version
```bash
git --version
```
```
## git version 2.14.5
```
--
<br>
<br>
- **If git is not installed YET**: See [Install git](https://happygitwithr.com/install-git.html) to follow the correct steps to install git according your system operative! :)
---
# Introduce yourself to Git
Let `git` know how you are following this simple configuration steps!
--
```bash
$ git config --global user.name "Criscely Lujan"
$ git config --global user.email "[email protected]"
$ git config --global core.editor vim
$ git config --global --list
```
--
- `user.name` can be your GitHub username. Your commits will be labelled with this name, so this should be informative!
--
- `user.email` must be the email that you use to sign up for GitHub.
--
- There are diverse options of [Git editor](http://swcarpentry.github.io/git-novice/02-setup/).
---
# Git Clients
--
- Git and Git client `are not` the same! Like R and RStudio is not the same thing! 💜
<br>
--
- Git client:
- Integrated development environment!
- Make the experience more pleasant providing a richer visual representation!
<br>
--
- Some Git clients:
- [SourceTreen](https://www.sourcetreeapp.com/)
- [GitKraken](https://www.gitkraken.com/)
- [GitUp](https://gitup.co/)
- [SmartGit](https://www.syntevo.com/smartgit/)
- [git-cola](https://git-cola.github.io/)
- ... others...
- **RStudio**
---
background-image: url("https://media.giphy.com/media/31Q36EHJ7C5ZoIMw79/giphy.gif")
background-position: 50% 50%
class: center, inverse
# Almost ready!
---
# How authenticating yourself with GitHub?
--
There are two options of protocols for secure communication working over a computer network!
--
- Hypertext Transfer Protocol Secure (HTTPS)
.pull-rigth[
<img src="img/https.png" width="200px" style="display: block; margin: auto;" />
]
--
If you plan to push/pull using HTTPS protocol, you can follow [Cache credentials for HTTPS](https://happygitwithr.com/credential-caching.html#credential-caching) for more information.
--
- Secure Shell (SSH)
.pull-rigth[
<img src="img/ssh.png" width="100px" style="display: block; margin: auto;" />
]
--
If you plan to push/pull using SSH protocol, you can follow [Set up keys for SSH](https://happygitwithr.com/ssh-keys.html#ssh-keys) for more information.
---
# RStudio and GitHub
<br>
--
## Setup Git + RStudio + GitHub
--
- Tools / Global Options / Select Git/SVN tab.
- Create the RSA key.
- Click, View public key, and copy the displayed public key.
- Save the key on your GitHub account: Settings / SSH key / Add SSH key.
<br>
Step by step here: [Connecting RStudio and GitHub](https://www.r-bloggers.com/rstudio-and-github/)
---
background-image: url("https://media.giphy.com/media/26AHyxxCItIbFijLO/giphy.gif")
background-position: 50% 50%
class: center, inverse
# Now we can really have fun!
---
# Make a new repo
- Go to https://github.com and login. Click in the green box called `New repository`.
--
- If you are on your own profile page, go to the section `Repositories`, then click the green box called `New`.
--
- Assign a name for the `repository` and include a `description` (this is optional but is recommended!).
--
- Public or private.
--
- Initializa the repository using the `README`.
---
<img src="img/github_makeRepo.png" width="800px" style="display: block; margin: auto;" />
---
# Clone a repo
## Using RStudio
- File -> New Project
--
- Version control
--
- Git
--
- Fill `Repository URL` and project name (what you want the folder to be called locally).
---
# Clone a repo
## Using terminal
- Create a new directory, open it and perform `git init` to create a new git repository:
```r
git init
```
--
- Clone the repository running the command `git clone` plus the path:
```r
git clone /path/to/repository
```
--
- When you are using a remote server, your command will be:
`git clone username@host:/path/to/repository`
- For example:
```r
git clone [email protected]:r-ladies-montpellier/20181212-RLadiesMontpellier-Meetup1.git
```
---
# Workflow
Your local repository consists of three "trees" maintained by git.
<br>
<img src="img/workflow.png" width="800px" style="display: block; margin: auto;" />
---
# Add and commit
- After clone the repository already clone on your computer, you can make changes and propose changes using `add` and `commit`:
For specific file:
```r
git add <filename>
```
--
Or adding all changes:
```r
git add .
```
--
Commit!
```r
git commit -m "Commit message"
```
--
Now the file (or changes in general) is committed to the `HEAD`, but not in your remote repository YET!
---
# Pushing changes
--
When your changes are in `HEAD`, your are ready to sent those changes to your remote repository, executing:
--
```r
# If your are not working in "master", change the branch
git push origin master
```
--
<br>
<br>
## If you dont know that is a `branch`, the next slide is for YOU! 💜
---
background-image: url("https://media.giphy.com/media/FX7A7ZBnOgz3W/giphy.gif")
background-position: 50% 80%
class: center, inverse
background-size: 500px
# Branches are used to develop features ISOLATED from each other!
---
# Branching
--
- The `master` branch is the default branch when you create a repository.
<br>
--
- We can create other branch for the development of other features (example: `develop` branch).
<br>
--
- We can merge branches.
--
<img src="img/branching.png" width="700px" style="display: block; margin: auto;" />
---
# Branching
Create a new branch named `feature_x` and switch to it using :
```r
git checkout -b feature_x
```
--
Switch back to `master`:
```r
git checkout master
```
--
To delete the brach `feature_x`:
```r
git branch -d feature_x
```
--
IMPORTANT!!!!!
Any branch in your local repository is available to others users unless you push the branch to the remore repository, doing:
```r
git push origin feature_x
```
---
# Update and merge
--
To update your local repository to the newest commit, execute:
```r
git pull
```
--
To merge another branch into your active branch (for example: master), use:
```r
git merge <branch>
```
--
Before marging changes in branch you can also see the differences!
```r
git diff <source_branch> <target_branch>
```
--
More information about git commands here: [Git the Simple guide](http://rogerdudler.github.io/git-guide/)
---
<img src="img/git_scheme.png" width="600px" style="display: block; margin: auto;" />
---
# Exercise
- Create a repo in GitHub.
- Clone the repo in your computer.
- Make changes (editting also the README.md and .gitignore)
- Make commits, if is possible include emojis to have fun! :)
- Use: push / pull / merge / status / etc.
- Check the changes in you remore repository.
- Develop a new branch, delete it, play, enjoy and ...
# ...be in problems, we are here to help you!
---
background-image: url("https://media.giphy.com/media/4EF5xIO5yiivWh4gGn/giphy.gif")
background-position: 50% 80%
class: center, inverse
background-size: 500px
# Follow the [R-Ladies Montpellier ](https://github.com/r-ladies-montpellier) in GitHub.
---
# Thanks!
- [R-Ladies Global](https://rladies.org/) for the help and support.
- [Jenny Bryan](https://github.com/jennybc): [Happy Git with R](https://happygitwithr.com/).
- Slides created via the R package [**xaringan**](https://github.com/yihui/xaringan) with the [**R-Ladies theme**](https://github.com/rladies/resources/blob/master/xaringan-slides/how_to_use.md)
- [Cowork'in Montpellier](http://coworkinmontpellier.org/).
<br>
<div class="figure" style="text-align: center">
<img src="img/rladies.png" alt="phdcomics.com" width="300px" />
<p class="caption">phdcomics.com</p>
</div>
</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js"></script>
<script>var slideshow = remark.create({
"highlightStyle": "github",
"highlightLines": true,
"countIncrementalSlides": false
});
if (window.HTMLWidgets) slideshow.on('afterShowSlide', function (slide) {
window.dispatchEvent(new Event('resize'));
});
(function() {
var d = document, s = d.createElement("style"), r = d.querySelector(".remark-slide-scaler");
if (!r) return;
s.type = "text/css"; s.innerHTML = "@page {size: " + r.style.width + " " + r.style.height +"; }";
d.head.appendChild(s);
})();</script>
<script>
(function() {
var i, text, code, codes = document.getElementsByTagName('code');
for (i = 0; i < codes.length;) {
code = codes[i];
if (code.parentNode.tagName !== 'PRE' && code.childElementCount === 0) {
text = code.textContent;
if (/^\\\((.|\s)+\\\)$/.test(text) || /^\\\[(.|\s)+\\\]$/.test(text) ||
/^\$\$(.|\s)+\$\$$/.test(text) ||
/^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(text)) {
code.outerHTML = code.innerHTML; // remove <code></code>
continue;
}
}
i++;
}
})();
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML';
if (location.protocol !== 'file:' && /^https?:/.test(script.src))
script.src = script.src.replace(/^https?:/, '');
document.getElementsByTagName('head')[0].appendChild(script);
})();
</script>
</body>
</html>