-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1644 lines (1398 loc) · 65.5 KB
/
index.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
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>William Durand | Git & GitHub & Open Source</title>
<link rel="stylesheet" href="reveal.js/css/reveal.css">
<link rel="stylesheet" href="reveal.js/css/theme/sky.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="css/mono-blue.css">
<link rel="stylesheet" href="fontawesome/css/font-awesome.min.css">
<link rel="stylesheet" href="css/custom.css">
<script>
if (window.location.search.match(/print-pdf/gi)) {
document.write('<link rel="stylesheet" href="reveal.js/css/print/pdf.css" type="text/css">');
}
</script>
<!--[if lt IE 9]>
<script src="reveal.js/lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<img src="images/lavajug.png" id="logo" />
<div class="reveal">
<div class="slides">
<section>
<h1 class="title">Git <span class="title-inverted">&</span> GitHub <span class="title-inverted">&</span> Open Source</h1>
<em>William Durand - November 26th, 2015</em>
</section>
<section data-markdown>
<script type="text/template">
Hi! I'm [Will](https://twitter.com/couac), the author of this slide deck.
<small>
This slide does not exist in the original deck, but it
is useful if you are<br>not familiar with
[Reveal.JS](https://github.com/hakimel/reveal.js), the framework
I used to write those slides.
</small>
<br>
The easiest way to **navigate** is **by hitting `[space]`<br>on your keyboard**.
You can also navigate with arrow<br>keys, but be careful because some
slides can be<br>nested inside of each other (vertically).
</script>
</section>
<section data-markdown>
<script type="text/template">
You can also find this deck on Speaker Deck:
<i class="fa fa-link"></i> [https://speakerdeck.com/willdurand/2015](https://speakerdeck.com/willdurand/2015)
</script>
</section>
<section>
<section data-markdown>
<script type="text/template">
## <i class="fa fa-warning"></i> What is <u>NOT</u><br>this talk about?
</script>
</section>
<section data-markdown>
<script type="text/template">
### Free Software != Open Source
<small>
<i class="fa fa-link"></i> [Why Open Source misses the point of Free Software](https://www.gnu.org/philosophy/open-source-misses-the-point.html) (according to Richard Stallman)
</small>
</script>
</section>
<section data-markdown>
<script type="text/template">
### Git For Newcomers
![](images/learn-git.gif)
<small>
<i class="fa fa-link"></i> [https://try.github.io](https://try.github.io)
</small>
</script>
</section>
</section>
<section data-markdown>
<script type="text/template">
## "Macro" Agenda
<center>
<br>
1. Git
<br>
<br>
2. Git(Hub|Lab) / Workflows
<br>
<br>
3. Open Source
</center>
</script>
</section>
<section>
<section data-markdown>
<script type="text/template">
# <i class="title-inverted fa fa-git"></i>
</script>
</section>
<section data-markdown>
<script type="text/template">
Git is a widely used **version control system** for software development.
It is a **distributed** revision control system.
<br>
<small>
<i class="fa fa-link"></i> <a href="https://en.wikipedia.org/wiki/Git_(software)">https://en.wikipedia.org/wiki/Git_(software)</a>
</small>
</script>
</section>
<section data-markdown class="no-border">
<script type="text/template">
### ![](images/git-local-remotes.png)
<small>
Credit: [https://aht.github.io/whatisgit/](https://aht.github.io/whatisgit/)
</small>
</script>
</section>
<section data-markdown>
<script type="text/template">
### Git Tip <span class="title-inverted">#1</span>
<br>
#### Local Cherry-Picking
``` bash
git checkout <other-branch> -- /path/to/file
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### Merge vs Rebase
![](images/merge_vs_rebase.png)
<small>
Credit: [http://surpreem.com/archives/1524](http://surpreem.com/archives/1524)
</small>
</script>
</section>
<section data-markdown>
<script type="text/template">
### No Fast Forward, Please.
![](images/no-ff.png)
</script>
</section>
<section data-markdown>
<script type="text/template">
### `pull` = `fetch` + `merge`
That's not what you want! No. Really.
<br>
```
git pull --rebase <remote> <branch>
```
</script>
</section>
<section data-markdown class="img-bg-color img-no-margin">
<script type="text/template">
### But, Rebase Kills Merges
![](images/pull-rebase-orig.png)
![](images/pull-rebase.png)
</script>
</section>
<section data-markdown>
<script type="text/template">
### Preserving existing merges
<br>
`git pull --rebase=preserve`
<br>or<br>
`pull.rebase=preserve` (config)
</script>
</section>
<section data-markdown>
<script type="text/template">
### Tadaaaam! <i class="fa fa-smile-o"></i>
![](images/pull-rebase-preserve.png)
</script>
</section>
</section>
<section>
<section data-markdown>
<script type="text/template">
## Advanced Features
</script>
</section>
<section data-markdown>
<script type="text/template">
### Git Tip <span class="title-inverted">#2</span>
<br>
#### Autocorrection FTW
``` bash
git config --global help.autocorrect 1
```
<br>
``` bash
git lol
WARNING: You called a Git command named 'lol', which does not exist.
Continuing under the assumption that you meant 'log'
in 0.1 seconds automatically...
commit 2feb149c8e76d12848f7535a8eb4d51b1c225776
Author: William Durand <[email protected]>
Date: Mon Nov 16 14:54:53 2015 +0100
add badges
...
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### Git Tip <span class="title-inverted">#3</span>
<br>
#### Built-In Auto-Completion
``` bash
git co<tab><tab>
commit config
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### `git archive`
<br>
``` bash
git archive --format zip -o snapshot.zip HEAD
```
<br>
"Export" all files from a given commit into a directory:
``` bash
git archive --format tar --prefix myapp/ <commit> | (cd /tmp && tar xf -)
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### **Re**use **Re**corded **Re**solution
``` bash
git config --global rerere.enabled true
```
<br>
``` bash
git merge master
Auto-merging index.html
CONFLICT (content): Merge conflict in index.html
Recorded preimage for 'index.html'
Automatic merge failed; fix conflicts and then commit the result.
```
``` bash
git commit --no-edit
Recorded resolution for 'index.html'
[old-branch abcd123] Merge branch 'master' into old-branch
```
<br>
``` bash
git merge master
Auto-merging index.html
CONFLICT (content): Merge conflict in index.html
Resolved 'index.html' using previous resolution.
```
<small>
<i class="fa fa-link"></i> [Fix conflicts only once with git rerere](https://medium.com/@porteneuve/fix-conflicts-only-once-with-git-rerere-7d116b2cec67)
</small>
</script>
</section>
<section data-markdown>
<script type="text/template">
### `git bisect`
Performs a **binary search** across a range of commits
<br>to help you find where an error was introduced:
``` bash
git bisect start
```
<br>
``` bash
git bisect good abcd123
```
``` bash
git bisect bad [badd123]
```
<br>
``` bash
# The script should end with a non-zero return status when it fails
git bisect run mvn clean test
```
</script>
</section>
</section>
<section>
<section data-markdown>
<script type="text/template">
## (My) Useful<br>Git Commands
</script>
</section>
<section data-markdown>
<script type="text/template">
### Stash
<br>
Quickly save current state:
``` bash
git stash -u 'current state'
```
<br>Restore it, later:
``` bash
git stash apply
```
<small>Or `git stash pop` but I rarely use it...</small>
</script>
</section>
<section data-markdown>
<script type="text/template">
### Interactive Rebase
``` bash
git rebase -i HEAD~<number of commits>
```
``` bash
pick d1ed4e4 Fix typo
pick b49cb42 Update for lavajug
pick e35510f Add new images
# Rebase 5f167bb..e35510f onto 5f167bb (3 command(s))
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### Fast Pull & Rebase
<br>
``` bash
git pull --rebase origin master
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### Atomic Commits
``` bash
git add -p
```
``` diff
diff --git a/test.js b/test.js
index 60ac996..2a57310 100644
--- a/test.js
+++ b/test.js
@@ -1,6 +1,5 @@
(function () {
- var i, j;
+ var i = 0, j;
- i = 0;
- j = i;
+ j = 1;
})();
Stage this hunk [y,n,q,a,d,/,s,e,?]? s
Split into 2 hunks.
@@ -1,3 +1,3 @@
(function () {
- var i, j;
+ var i = 0, j;
Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]?
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### Amending A Commit
<br>
``` bash
git commit --amend
```
<br>
``` bash
git commit --amend -m 'Fix undefined variable j
Fix #123'
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### Go Back
<br>
``` bash
git checkout -
Switched to branch 'master'
```
``` bash
git checkout -
Switched to branch 'feat-undefined-variable'
```
<small>Also works with `merge`, `cherry-pick` and `rebase`.</small>
</script>
</section>
<section data-markdown>
<script type="text/template">
### (Un)Merged Branch
<br>
``` bash
git branch --no-merged
develop
feat-another-feature
feat-my-feature
fix-undefined-variable
```
<br>
``` bash
git branch --merged
* master
```
</script>
</section>
</section>
<section>
<section data-markdown>
<script type="text/template">
## Dealing With<br>PATCH <span class="title-inverted">&</span> DIFF
</script>
</section>
<section data-markdown>
<script type="text/template">
### Creating A Patch
```
git format-patch master --stdout > fix-undefined-variable.patch
```
```
From: William Durand <[email protected]>
Date: Thu, 13 Nov 2015 10:22:17 +0100
Subject: [PATCH] Fix undefined variable
---
test.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test.js b/test.js
index 760e4eb..60ac996 100644
--- a/test.js
+++ b/test.js
@@ -1,5 +1,5 @@
(function () {
- var i;
+ var i, j;
i = 0;
j = i;
--
2.1.2
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### Changes Overview
<br>
```
git apply --stat fix-undefined-variable.patch
```
```
test.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### Test The Patch
<br>
```
git apply --check fix-undefined-variable.patch
```
<br>
No output == <i class="fa fa-thumbs-o-up"></i>
</script>
</section>
<section data-markdown>
<script type="text/template">
### Then, Apply
<br>
``` bash
git am --signoff < fix-undefined-variable.patch
```
``` bash
Applying: Fix undefined variable
```
``` bash
commit 4c20f8d517b99638f5379f3f0894ad076d2b6a5b
Author: William Durand <[email protected]>
Date: Thu Nov 13 10:22:17 2015 +0100
Fix undefined variable
Signed-off-by: William Durand <[email protected]>
```
<br>
BTW, `patch -p1` works too!
</script>
</section>
</section>
<section>
<section data-markdown>
<script type="text/template">
# <i class="title-inverted fa fa-github"></i> GitHub
</script>
</section>
<section>
<img src="images/github.png" class="no-border" />
</section>
<section data-markdown>
<script type="text/template">
GitHub is the largest code host on the planet<br>with over **29.5 million** repositories.
</script>
</section>
<section data-markdown>
<script type="text/template">
### Integrated Issue Tracking
![](images/issues.png)
</script>
</section>
<section data-markdown>
<script type="text/template">
### Integrated Issue Tracking
![](images/issue-view.png)
</script>
</section>
<section data-markdown>
<script type="text/template">
### Syntax Highlighting
![](images/issue-code.png)
</script>
</section>
<section data-markdown>
<script type="text/template">
### Collaborative Code Review
![](images/pr.png)
</script>
</section>
<section data-markdown>
<script type="text/template">
### Collaborative Code Review
![](images/codecomments.png)
</script>
</section>
<section data-markdown>
<script type="text/template">
### Pull Request (PR)
**P**ull **R**equest = Code + Issue + Code Comments
</script>
</section>
<section>
<h3>GitHub Pages</h3>
<img src="images/pages.png" class="no-border" />
</section>
<section data-markdown>
<script type="text/template">
### GitHub Pages
* [Jekyll](http://jekyllrb.com/)-friendly
* Custom URLs
* Built-in layouts
<br>
Also, checkout [5minfork.com](http://5minfork.com/)!
</script>
</section>
<section data-markdown>
<script type="text/template">
### Release Management
![](images/release.png)
</script>
</section>
<section data-markdown>
<script type="text/template">
### Compare View
![](images/compare.png)
</script>
</section>
<section data-markdown>
<script type="text/template">
### Protected Branches
![](images/protected-branches.png)
</script>
</section>
<section data-markdown>
<script type="text/template">
### GitHub Tip <span class="title-inverted">#1</span>
#### `t` File Finder
![](images/filefinder.png)
</script>
</section>
<section data-markdown>
<script type="text/template">
### GitHub Tip <span class="title-inverted">#2</span>
#### `.patch`
``` http
https://github.com/your/repo/commit/e0af340837978f80d8cd144a4475.patch
```
![](images/patch.png)
</script>
</section>
<section data-markdown>
<script type="text/template">
### Applying A Commit As A Patch
<br>
``` bash
curl https://github.com/your/repo/commit/<SHA>.patch |git am
Applying: Fix undefined variable
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### Also, `.diff`
``` http
https://github.com/your/repo/commit/e0af340837978f80d8cd144a4475.diff
```
![](images/diff.png)
</script>
</section>
</section>
<section>
<section data-markdown>
<script type="text/template">
## `hub`
git + hub = github
<br>
`alias git=hub`
</script>
</section>
<section data-markdown>
<script type="text/template">
### Clone
``` bash
git clone random/repo
# git clone git://github.com/random/repo.git
```
``` bash
git clone repo
# git clone git://github.com/YOUR/repo.git
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### Browse
``` bash
git browse
# open https://github.com/random/repo
```
``` bash
git browse -- issues
# open https://github.com/random/repo/issues
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### Easy Fetch
``` bash
git fetch ubermuda
# git remote add ubermuda git://github.com/ubermuda/repo.git
# git fetch ubermuda
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### Checkout <i class="fa fa-heart"></i>
``` bash
git checkout https://github.com/your/repo/pull/123
# git remote add contributor git://github.com/contributor/repo.git
# git fetch contributor
# git checkout -b contributor-branch contributor/branch
```
<br>
Best way to [work on|review|test] a Pull Request so far!
</script>
</section>
<section data-markdown>
<script type="text/template">
### Apply Commits
``` bash
git am -3 https://github.com/your/repo/pull/123
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### Cherry-Pick
``` bash
git cherry-pick https://github.com/random/repo/commit/SHA
# git remote random git://github.com/random/repo.git
# git fetch random
# git cherry-pick SHA
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### More!
``` bash
git fork, git pull-request, merge, ci-status, etc.
```
<br>
<small>
<i class="fa fa-link"></i> [hub.github.com](https://hub.github.com/)
</small>
</script>
</section>
</section>
<section>
<section data-markdown>
<script type="text/template">
## GitLab
</script>
</section>
<section data-markdown class="no-border">
<script type="text/template">
### ![](images/gitlab.png)
</script>
</section>
<section data-markdown>
<script type="text/template">
GitLab is an **Open Source** (MIT licensed)
web-based Git repository manager with wiki and
issue tracking features.
</script>
</section>
<section data-markdown>
<script type="text/template">
GitLab started a side project in 2011.
<br>
In 2015, more than 800 (worldwide) contributors,
10+ employees, and 1.5M raised in seed funding in July.
</script>
</section>
<section data-markdown>
<script type="text/template">
### Getting Started
* [gitlab.com](https://gitlab.com)
* [git.framasoft.org](https://git.framasoft.org)
* On your [Raspberry Pi](https://about.gitlab.com/2015/04/21/gitlab-on-raspberry-pi-2/)
* In your company
<br>
**Pro-tip:** Merge Request ≈ Pull Request
</script>
</section>
</section>
<section>
<section data-markdown>
<script type="text/template">
## Workflows
</script>
</section>
<section data-markdown>
<script type="text/template">
### Common Workflows
<br>
* **Centralized** workflow (with a shared repository)
* **Blessed** repository (with a release manager)
* **Lieutenant** workflow (blessed repo. + trusted lieutenants and a dictator)
</script>
</section>
<section data-markdown>
<script type="text/template">
### Git Flow
"[A successful Git branching model](http://nvie.com/posts/a-successful-git-branching-model/)"
<p class="fragment">
<br>
Well... Maybe not.
See [this simple<br>git branching model](https://gist.github.com/jbenet/ee6c9ac48068889b0912) instead.
</p>
</script>
</section>
<section data-markdown>
<script type="text/template">
### GitHub Flow
![](images/github_flow.png)
<small>
<i class="fa fa-link"></i> [Understanding the GitHub Flow](https://guides.github.com/introduction/flow/index.html)
</small>
</script>
</section>
<section data-markdown>
<script type="text/template">
### GitLab Flow
![](images/gitlab_flow.png)
<small>
<i class="fa fa-link"></i> [GitLab Flow](https://about.gitlab.com/2014/09/29/gitlab-flow/)
</small>
</script>
</section>
<section data-markdown>
<script type="text/template">
### Pouce Driven Development
<br>
👍 + 👍 = Good to merge/ship
</script>
</section>
</section>
<section>
<section data-markdown>
<script type="text/template">
# Open Source
</script>
</section>
<section data-markdown>
<script type="text/template">
In production and development, Open Source as a development model promotes a **universal
access** via a **free license** to a product's design or blueprint [...].
<br>
<small>
<i class="fa fa-link"></i> [http://en.wikipedia.org/wiki/Open_source](http://en.wikipedia.org/wiki/Open_source)
<small>
</script>
</section>
<section data-markdown>
<script type="text/template">
Open-source software is very often developed<br>in a **public**, **collaborative** manner.
</script>
</section>
</section>
<section>
<section data-markdown>
<script type="text/template">
## How To Contribute?
</script>
</section>
<section data-markdown>
<script type="text/template">
Everyone can contribute.
</script>
</section>
<section data-markdown>
<script type="text/template">
### Fork The Repository
![](images/fork.png)
</script>
</section>
<section data-markdown>
<script type="text/template">
### Create A Branch
``` bash