-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
519 lines (497 loc) · 23.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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>reveal.js</title>
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/night.css" id="theme">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<link rel="stylesheet" href="css/hackerschool.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="right logo">
<img src="imgs/LogotipoB.png"/>
</div>
<div class="left twitter">
<a href="http://twitter.com/HackerSchoolIST">@HackerSchoolIST</a>
</div>
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1 style="text-shadow: none; margin-bottom:30px">Git & Github</h1>
<h3 style="text-transform: lowercase">like a sir</h3>
<p>
<small>Created by <a href="http://diutsu.xyz">Gonçalo Sousa</a> </br> <a href="http://Github.com/diutsu">Github.com/diutsu</a></small>
</p>
</section>
<section>
<h2 style="text-transform: lowercase">git</h3>
<blockquote cite="http://git-scm.com">
“Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.”
</blockquote>
</section>
<section>
<blockquote cite="http://git-scm.com">
“Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.
</blockquote>
</section>
<section>
<blockquote cite="http://en.wikipedia.org/wiki/git_(software)">
“Git /ɡɪt/ is a distributed revision control and source code management (SCM) system with an emphasis on speed. Git was initially designed and developed by Linus Torvalds for Linux kernel development in 2005.”
</blockquote>
</section>
<section>
<h2>Controlo de versões</h2>
<p>
Gestão das alterações a documentos, código ou outros tipos de informação.</p>
<p>
Identificadas por número ou código, e associado um timestamp e responsável.
</p>
<aside class="notes">
The need for a logical way to organize and control revisions has existed for almost as long as writing has existed, but revision control became much more important, and complicated, when the era of computing began. The numbering of book editions and of specification revisions are examples that date back to the print-only era. Today, the most capable (as well as complex) revision control systems are those used in software development, where a team of people may change the same files.
Version control systems (VCS) most commonly run as stand-alone applications, but revision control is also embedded in various types of software such as word processors and spreadsheets, e.g., Google Docs and Sheets[1] and in various content management systems, e.g., Wikipedia's Page history. Revision control allows for the ability to revert a document to a previous revision, which is critical for allowing editors to track each other's edits, correct mistakes, and defend against vandalism and spam.
</aside>
</section>
<section>
<h2>First and Foremost</h2>
<p>
Usar em todos os projectos</br>
</br>mesmo que o estejas a fazer sozinho
</p>
</section>
<section>
<h2>O que meter no git?</h2>
<p><strong class="fragment">java</strong><strong class="fragment">, matlab</strong><strong class="fragment">, 3D printing</strong><strong class="fragment">, LaTeX...</strong> </br>
<p class="fragment">e todos os ficheiros de texto dos vossso projectos</p><br/><br/>
<p class="fragment">... mas também podem colocar ficheiros binários</p>
</p>
<aside class="notes">
Git also supports binary files, and can version them, but the diffs will not work
</aside>
</section>
<section>
<h2>Vantagens</h2>
<ul>
<li>backups</li>
<li>sincronização</li>
<li>desfazer alterações</li>
<li>seguir as mudanças</li>
<li>quem fez o quê</li>
<li>branches e merges</li>
<li>ambientes isolados</li>
</ul>
</section>
<section>
<h2>Repositórios de Git</h2>
<img height="500px" src="http://git-scm.com/figures/18333fig0103-tn.png" alt="rcs">
</section>
<section>
<h2>Primeiro passo: instalar o git</h2>
<section>
<pre><code data-trim>
# Debian/Ubuntu
apt-get install git-all
</code></pre>
</section>
<section>
<pre><code data-trim>
# Debian/Ubuntu
apt-get install git-all
# ArchLinux
pacman -S git gitk
# Gentoo
emerge --ask --verbose dev-vcs/git
# Fedora 21 / Red-hat
yum install git-all
# Fedora 22+
dnf install git
# OpenSUSE
zypper install git
# FreeBSD
cd /usr/ports/devel/git
make install
# Solaris 11 Express
pkg install developer/versioning/git
# OpenBSD
pkg_add git
</code></pre>
</section>
<section>
<h2>OS X / Windows</h2>
<p class="fragment fade-out">install Linux</p>
<div class="fragment" style="margin-top: -2em">
<p><a href="http://git-scm.com/downloads/">http://git-scm.com/downloads/</a></p>
<br/>
<h4>OS X via brew</h4>
<pre><code data-trim>brew install git</code></pre>
</div>
</section>
</section>
<section>
<section>
<h2>Não há interfaces gráficas?</h2>
<div class="fragment">
<p>Para quê?</p>
<img src="imgs/lsd.png" />
</div>
</section>
<section>
<h2>Não há interfaces gráficas?</h2>
<p>Há, é só escolher:</p>
<a href="http://git-scm.com/downloads/guis">http://git-scm.com/downloads/guis</a></p>
<p>Pessoalmente CLI + gitk + meld</p>
</section>
<section>
<h2>SourceTree</>
<img src="imgs/sourceTree.png" />
</section>
<section>
<h2>GitKraken</>
<img src="imgs/gitkraken.png" />
</section>
</section>
<section>
<h2>Não posso usar isso num IDE?</h2>
<div class="fragment"><p>Claro que sim!<br/>
<a href="https://www.eclipse.org/eGit/">https://www.eclipse.org/eGit/</a><br/>
<a href="https://sublimegit.net/">https://sublimegit.net/</a><br/>
...</p>
</div>
</section>
<section>
<h2>Ready?</h2>
<h3>Usando git</h3>
</section>
<section>
<h2>Criar um repositório</h2>
<p >Criar uma nova pasta "gitWS"</p>
<p >Abrir a pasta num terminal<br/>git bash no Windows</p>
<pre class="fragment bash"><code data-trim contenteditable >git init</code></pre>
<pre class="fragment bash"><code data-trim>Initialized empty Git repository in /home/diutsu/gitWS/.git</code></pre>
</section>
<section data-background="#6BBA71">
<h2>ProTip#1</h2>
<div class="fragment">
<p>Sempre que quiserem saber o estado do vosso repositório</p>
<pre class="bash"><code data-trim >git status</code></pre>
</div>
<pre class="fragment result"><code class="bash" data-trim ># On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
</code></pre>
</section>
<section>
<h2>Adicionar ficheiros</h2>
<div class="fragment"><p>Criar um ficheiro readme.md com</p>
<pre class="bash"><code data-trim>#git repository
## This is my first file on this repository
I should describe this project here.
</code></pre>
</div>
<pre class="fragment bash"><code data-trim >git status</code></pre>
<pre class="fragment bash"><code data-trim>On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
readme.md
nothing added to commit but untracked files present (use "git add" to track)</code></pre>
</section>
<section data-background="#6BBA71">
<h2>ProTip#2</h2>
<img style="border:white solid 10px;background:white" src="http://git-scm.com/book/en/v2/book/02-git-basics/images/lifecycle.png" alt="git workflow"/>
</section>
<section>
<h2>Adicionar ficheiros ao repositório</h2>
<pre class="fragment bash"><code data-trim >git add readme.md</code></pre>
<pre class="fragment bash"><code data-trim>On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: readme.md
</code></pre>
</section>
<section>
<h2>Fazer commit</h2>
<pre class="fragment bash"><code data-trim >git commit</code></pre>
<p class="fragment">Adiciona a tua mensagem de commit</p>
<pre class="fragment bash"><code data-trim>[master (root-commit) eaee897] My first commit
1 file changed, 3 insertions(+)
create mode 100644 readme.
</code></pre>
</section>
<section data-background="#6BBA71">
<h2>The über fast way</h2>
<p class>Lets write another line on readme.md</p>
<pre class="fragment bash"><code data-trim >git commit -a -m "Your commit message"</code></pre>
</section>
<section>
<h2>History is a Weapon</h2>
<p>You can always check your repository history</p>
<pre class="fragment bash"><code data-trim >git log</code></pre>
</section>
<section data-background="#6BBA71">
<h2>Pretty tip</h2>
<p>try out these git log</p>
<pre class="bash"><code data-trim >git log --p</code></pre>
<pre class="bash"><code data-trim >git log --oneline</code></pre>
<pre class="bash"><code data-trim >git log --abbrev-commit</code></pre>
<pre class="bash"><code data-trim >git log --date=relative --pretty=format:"%h - %an, %ar : %s"</code></pre>
</section>
<section>
<h2>So you said Git has good branching ...</h2>
<pre class="fragment bash"><code data-trim >git branch alpha
git checkout alpha </code></pre>
<div class="fragment"><p>ou com açúcar</p>
<pre class="bash"><code data-trim >git checkout -b alpha</code></pre></div>
</section>
<section data-background="#6BBA71">
<h2>How many branches are there?</h2>
<pre class="bash"><code data-trim >git branch -vv</code></pre>
</section>
<section>
<h2>Changes on new branch</h2>
<p>Escrevam uma nova linha no readme.md</p>
<pre class="bash"><code data-trim >git commit -am "This is a test feature"</code></pre>
</section>
<section>
<h2>Back to master and merge</h2>
<pre class="bash"><code data-trim >git checkout master</code></pre>
<p>Vejam que o ficheiro está igual ao que estava antes de mudarem de branch</p>
<pre class="fragment bash"><code data-trim >git merge alpha</code></pre>
<div class="fragment"><pre class="bash"><code data-trim >Updating 452941e..8da4cb8
Fast-forward
readme.md | 2 ++
1 file changed, 2 insertions(+)
</code></pre>
<p class="fragment">Profit!</p></div>
</section>
<section>
<h2>Not everything is this smooth</h2>
<pre class="fragment bash"><code data-trim >git checkout master</code></pre>
<p class="fragment">Alterem uma linha no readme</p>
<pre class="fragment bash"><code data-trim >git commit -am "There was a bug, temporary fix"</code></pre>
</section>
<section>
<h2>Not everything goes smoothly</h2>
<pre class="fragment bash"><code data-trim >git checkout alpha</code></pre>
<p class="fragment">Alterem a mesma linha do readme, para outra coisa</p>
<pre class="fragment bash"><code data-trim >git commit -am "This feature is complete now"</code></pre>
</section>
<section>
<h2>When merge fails</h2>
<pre class="fragment bash"><code data-trim >git checkout master</code></pre>
<pre class="fragment bash"><code data-trim >git merge alpha</code></pre>
<div class="fragment"><pre class="bash"><code data-trim >Auto-merging readme.md
CONFLICT (content): Merge conflict in readme.md
Automatic merge failed; fix conflicts and then commit the result.
</code></pre><p>We have to fix these conflits first before we can commit the merge</p></div>
</section>
<section>
<h2>Merge first-aid</h2>
<pre><code>
<<<<<<< HEAD
But this description can be altered
=======
This project is my first experience with git scm.
This description can be changed.
And so it begun
>>>>>>> alpha
</code></pre>
<p>HEAD é um alias para o commit/branch actual</p>
<p>Depois do "======" estão as alterações a que estão fazer merge</p>
<pre class="fragment bash"><code data-trim >git commit -m "merged fix for previous problem"</code></pre>
</section>
<section data-background="#6BBA71">
<h2>Merge tips</h2>
<pre class="bash"><code data-trim >git mergetool</code></pre>
<p>opens your prefered diff editor</p>
</section>
<section>
<h1>Tired of this CLI stuff?</h1>
<h3>Lets see some pretty interfaces</h3>
</section>
<section>
<h2>SourceTree</h2>
<h3>Live merging demo</h3>
<img class="logo" src="imgs/sourcetree-logo.png"/>
</section>
<section>
<h2>Remotes</h2>
<p>É um repositório noutro pc</p>
<p>Pode estar no pc do teu colega, Github, ou outro servidor</p>
<p>Repositório do projecto para que estás a contribuir - <i>upstream</i></p>
<p>Podes ter vários remotes simultaneamente</p>
</section>
<section>
<h3>Remotes</h3>
<img src="imgs/remotes.png"/>
</section>
<section>
<h2>Github</h2>
<img src="imgs/github.png" />
</section>
<section>
<h2>Github</h2>
<p>Quem ainda não tiver, criar uma conta.</p>
<p class="fragment">Criar um novo repositório, vazio</p>
<p class="fragment">Adicionar este remote ao nosso repositório</p>
<pre class="fragment bash"><code data-trim >git remote add origin [email protected]:diutsu/gitWS.git</code></pre>
<pre class="fragment bash"><code data-trim >git push -u origin master</code></pre>
</section>
<section>
<h2>Branches</h2>
<p>Reparem que nas branches do github não está lá a branch alpha</p>
<p>Há que fazer push de todas as branches individualmente</p>
<pre class="fragment bash"><code data-trim >git push origin alpha</code></pre>
</section>
<section data-background="#6BBA71">
<h2>Pull allways get all branches</h2>
<pre class="fragment bash"><code data-trim >git pull</code></pre>
</section>
<section>
<h2>Forks</h2>
<p>Cópias de outros repositórios</p>
<p>Parte do esquema de <i>pull-request</i> do github</p>
<p>Remote para os repositórios do vosso PC</p>
<a href="http://github.com/diutsu/Qt-Calculator">http://github.com/diutsu/Qt-Calculator</a>
</section>
<section>
<h2>Give back, get street cred</h2>
<p>Podes submeter as tuas alterações para o upstream</p>
<p><i>Pull request</i></p>
</section>
<section>
<h2>Pull Request</h2>
<p>É o workflow standard para o github</p>
<p>Cada contribuidor tem um fork do repositório</p>
<p>Desenvolvem contra o seu repositório</p>
<p>Assim que tiverem a tarefa completa criam um pull request</p>
</section>
<section>
<h2>Pull Request</h2>
<img src="imgs/pullrequest.png">
</section>
<section>
<h2>Update your fork</h2>
<pre class="fragment bash"><code data-trim >git remote add upstream [email protected]:diutsu/Qt-Calculator.git</code></pre>
<pre class="fragment bash"><code data-trim >git fetch upstream</code></pre>
<pre class="fragment bash"><code data-trim >git checkout master</code></pre>
<pre class="fragment bash"><code data-trim >git merge upstream/master</code></pre>
<pre class="fragment bash"><code data-trim >git push origin</code></pre>
</section>
<section>
<h2>I feel lonely</h2>
<p>Adiciona contribuidores ao teu projecto no github</p>
<p>Para projectos em servidores privados, basta que tenhas acesso ao servidor</p>
<p>Já agora, é de referir que o git diferencia quem faz o commit e quem faz o push/merge</p>
</section>
<section>
<h2>Students rejoice</h2>
<p>repositórios privados <b>ilimitados</b> gratuítos no Github</p>
<p><a href="https://education.github.com/">https://education.github.com/</a></p>
</section>
<section>
<h2>Github has a few treasures</h2>
<p>Issues, wiki, github-pages, gists</p>
</section>
<section>
<h2>Adding Files, and bad things</h2>
<p>Adicionem um novo ficheiro</p>
<pre class="fragment bash"><code data-trim >git commit -a -m "Your commit message"</code></pre>
<pre class="fragment bash"><code data-trim >git push</code></pre>
<p class="fragment">A few minutes later...</p>
<p class="fragment">"Oh Zé não está lá nada!"</p>
<pre class="fragment bash"><code data-trim >git status</code></pre>
<p class="fragment">Ups e agora?</p>
</section>
<section>
<h2>Change your commit, and why you should not do that</h2>
<pre class="fragment bash"><code data-trim >git add newFile.txt</code></pre>
<pre class="fragment bash"><code data-trim >git commit --ammend</code></pre>
<p class="fragment">This is a new commit, replacing the old one.</p>
<pre class="fragment bash"><code data-trim >git push</code></pre>
<p class="fragment">DO NOT ammend, or rebase, public code</p>
<pre class="fragment bash"><code data-trim >git push -f</code></pre>
</section>
<section>
<h2>Other git workflows</h2>
</section>
<section>
<h2>A centralized repository</h2>
<p>É o método mais parecido com o SVN</p>
<p>O pull é feito sempre com rebase, para manter a história linear</p>
<pre class="bash"><code data-trim >git pull --rebase</code></pre>
<p>Caso hajam conflitos, resolvem-se, faz-se add e continua-se</p>
<pre class="bash"><code data-trim >git rebase --continue</code></pre>
<p>ou aborta-se</p>
<pre class="bash"><code data-trim >git rebase --abort</code></pre>
</section>
<section>
<h2>A centralized repository</h2>
<img src="imgs/centralized.png"/>
</section>
<section>
<h2>Feature branch</h2>
<p>Desenvolves cada feature numa branch à parte.</p>
<p>Assim que estiver completa, e revista, faz-se merge para a master</p>
</section>
<section>
<h2>Feature branch</h2>
</sectionimg src="imgs/feature1.png">
</section>
<section>
<h2>Gitflow</h2>
<p>Muito parecido ao feature branch</p>
<p>Acrescenta algumas branches com significado especial</p>
<p><i>master</i> - apenas o código na release oficial,</br>
<i>develop</i> - código em desenvolvimento</br>
<i>release</i> - em preparação para uma release</br>
<i>hotfix</i> - para correcção de bugs na <i>master</i></p>
</section>
<section>
<h2>Gitflow</h2>
<img src="imgs/gitflow.png"/>
</section>
<section>
<h1>F I M</h1>
<p>Reve os slides aqui: <a href="http://diutsu.xyz/git">diutsu.xyz/git</a> ou faz clone e fork do repositório</p>
<a href="http://github.com/diutsu/git-workshop"><pre class="bash"><code data-trim>git clone https://github.com/diutsu/git-workshop</code></pre></a>
<small class="fragment grow">made with git, reveal.js and ViM</small>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: false,
progress: true,
history: true,
center: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'none', // default/cube/page/concave/zoom/linear/fade/none
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
</script>
</body>
</html>