-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
440 lines (419 loc) · 14 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
<!doctype html>
<!-- vim: set ts=2 sw=2 noexpandtab: -->
<html lang="en">
<head>
<meta charset="utf-8">
<title>git ± intro</title>
<meta name="description" content="A gentle introduction to the Git version control system">
<meta name="author" content="Michael Imamura">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link rel="stylesheet" href="css/reveal.min.css">
<link rel="stylesheet" href="css/theme/beige.css" id="theme">
<link rel="stylesheet" href="css/git-intro.css">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!--
I apologize in advance for the formatting.
I used rvl.io to build the outline, which in hindsight was a mistake.
Hopefully it's fixed up enough now to be readable.
-->
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1>git ± intro</h1>
<p><br></p>
<div>Wed Oct 22 2014 :: Mike Imamura</div>
</section>
<section>
<div>
<img src="res/logo/logo-a.png" class="logo fragment roll-in"><br>
<img src="res/logo/logo-b.png" class="logo fragment roll-in"><br>
<img src="res/logo/logo-c.png" class="logo fragment roll-in"><br>
<img src="res/logo/logo-d.png" class="logo fragment"><img src="res/logo/logo-e.png" class="logo fragment"></div>
</section>
<section>
<h2>8-step program for<br><i>better source control</i></h2>
<div>
<ul>
<li>Speed</li>
<li>Reliability</li>
<li>Flexibility</li>
<li>Scalability</li>
<li>Extensibility</li>
<li>Fairness</li>
<li>Openness</li>
<li>Tool Integration</li>
</ul>
</div>
</section>
<section>
<section>
<h2>Clients</h2>
<table class="clients" width="100%">
<col width="50%"><col width="50%">
<tr>
<td><a href="http://code.google.com/p/tortoisegit/"><img
src="res/clients/tortoisegit.png"><br>
TortoiseGit (Windows)</a></td>
<td><a href="http://git-scm.com/"><img
src="res/clients/term.png"><br>
Command-Line</a></td>
</tr>
<tr>
<td><a href="http://windows.github.com/"><img
src="res/clients/github-win.png"><br>
GitHub For Windows</a></td>
<td><a href="http://mac.github.com/"><img
src="res/clients/github-mac.png"><br>
GitHub For Mac</a></td>
</tr>
</table>
</section>
<section>
<h2>Installing Git</h2>
<table class="linux-install" width="100%">
<tr>
<th>Debian / Ubuntu</th>
<td>apt-get install git</td>
</tr>
<tr>
<th>RedHat / Fedora</th>
<td>yum install git</td>
</tr>
<tr>
<th>Arch Linux</th>
<td>pacman -S git</td>
</tr>
<tr>
<th>Gentoo</th>
<td>emerge dev-vcs/git</td>
</tr>
</table>
</section>
</section>
<section>
<h2>Tell Git a Little About Yourself</h2>
<div>Git uses email addresses to identify users.</div>
<pre>git <b>config</b> --global user.name "George P. Burdell"</pre>
<pre>git <b>config</b> --global user.email gburdell@example.com</pre>
<div>These can be per-repository —<br>
just leave off the <code>--global</code></div>
</section>
<section>
<h2>GitHub</h2>
<div><br></div>
<div>
<a href="http://github.com/">http://github.com/</a>
</div>
<div><br></div>
<div>Free repository, issue tracker, wiki, and simple website
for Open Source projects.</div>
</section>
<section>
<h2>git clone</h2>
<div>Make your own personal copy of the repository.</div>
<pre>git <b>clone</b> https://github.com/ZoogieZork/Git-Intro.git</pre>
</section>
<section>
<section>
<h2>Getting Things Done</h2>
<div>Get the latest changes:</div>
<pre>git <b>pull</b></pre>
<div>Make some changes, then stage them:</div>
<pre>git <b>status</b> <i># List changes</i></pre>
<pre>git <b>add</b> new_file.html modified_file.html
git <b>rm</b> deleted_file.html
git <b>checkout</b> file.html <i># Undo modifications</i></pre>
<p>Commit staged files:</p>
<pre>git <b>commit</b></pre>
</section>
<section>
<h2>Getting Things Done, cont'd</h2>
<div>Before publishing your changes,<br>get everybody else's changes first:</div>
<pre>git pull</pre>
<p>Publish your changes:</p>
<pre>git push</pre>
</section>
</section>
<section>
<h2>Getting Things Done (faster)</h2>
<div>Stage all changes:</div>
<pre>git <b>add -A .</b></pre>
<div>Commit all modified and deleted files<br>(but not new files):</div>
<pre>git <b>commit -a</b></pre>
</section>
<section>
<h2>.gitignore</h2>
<div>Add a .gitignore file to exclude files from the shortcut commands (e.g. <b>git add -A</b>).</div>
<div>
<br>
</div>
<pre># Ignore files in this directory and all subdirectories.
*.class
*.pyc
# Ignore specific files and directories
# (relative to this directory)
/target/
/test/output/*.xml</pre>
</section>
<section>
<h2>Getting Things Done (smarter)</h2>
<div>Stage only part of a file:</div>
<pre>git <b>add -p</b> file.html</pre>
<div>Show your changes in the commit editor:</div>
<pre>git <b>commit -v</b></pre>
<div>Temporarily save what you're working on…</div>
<pre>git <b>stash</b></pre>
<div>… do something else …</div>
<div>… then pick up where you left off:</div>
<pre>git <b>stash pop</b></pre>
</section>
<section>
<section>
<h2>Branches</h2>
<div>Create a new local branch:</div>
<pre>git <b>checkout -b</b> fixes</pre>
<p><br></p>
<div>Create a local branch based on a published branch:</div>
<pre>git <b>checkout --track</b> <b>origin/</b>fixes</pre>
<p><br></p>
<p>Switch between branches:</p>
<pre>git <b>checkout</b> master<br>git <b>checkout</b> fixes</pre>
<br>
</section>
<section>
<h2>Merging</h2>
<div>Merge "master" to your branch:</div>
<pre>git <b>checkout</b> fixes <i># Switch to your branch.</i>
git <b>merge</b> master <i># Merge changes from master</i></pre>
<div>
<br>
</div>
<div>Merge your branch back into "master":</div>
<pre>git <b>checkout</b> master <i># Switch back to master.</i>
git <b>merge</b> fixes</pre>
<p>
<br>
</p>
<p>All done with the branch, delete it:</p>
<pre>git <b>branch -d</b> fixes</pre>
</section>
<section>
<h2>Sharing Branches</h2>
<div>Publish your branch:</div>
<pre>git <b>push -u origin</b> fixes</pre>
<div><br></div>
<div>Delete a published branch:</div>
<pre>git <b>push origin --delete </b>fixes</pre>
<aside class="notes">
Or "git push origin :fixes" if you're sufficiently oldschool and/or
hardcore. You know who you are.
</aside>
</section>
</section>
<section>
<section>
<h2>Pull Requests</h2>
<div>GitHub<br></div>
<div>Review & discuss changes <i>before</i> merging</div>
</section>
<section>
<h2>Pull Request</h2>
<div><br></div>
<div>
<ol>
<li>Gather your changes in a branch.</li>
<li>Publish the branch.</li>
<li>Create a Pull Request on GitHub.</li>
</ol>
</div>
</section>
</section>
<section data-state="alert">
<h1>intermediate ± git</h1>
<div>Here be bobcats</div>
</section>
<section>
<section>
<h2>Rewriting History</h2>
<div><br></div>
<div class="fragment roll-in"><i>Optimist:</i><br>
If you haven't pushed it yet, you can still change it</div>
<div><br></div>
<div class="fragment roll-in"><i>Pessimist:</i><br>
If you change a pushed commit, bad things happen</div>
<aside class="notes">
History is written by the victors, and we're all winners here.
</aside>
</section>
<section>
<div>(don't change published history)</div>
</section>
</section>
<section>
<h2>Oops, I made a typo…</h2>
<div>Stage your fixes like usual...</div>
<div><br></div>
<div>Then amend the previous commit instead of creating a new one:</div>
<pre>git <b>commit --amend</b></pre>
</section>
<section>
<h2>pull + rebase</h2>
<div>Pull in other people's commits, but <i>move</i> your unpushed
commits to the end.</div>
<pre>git <b>pull --rebase</b></pre>
<div><br></div>
<div>Some teams prefer this since it results in more linear history.</div>
<aside class="notes">
Which is easier to read if you're trying to get from point A to point B,
the turn-by-turn directions from Google Maps or the London tube diagram?
</aside>
</section>
<section>
<h2>Rebase Whole Branches</h2>
<div>Move all of the commits in your local branch to the end of the
branch it split off from:</div>
<pre>git checkout mybranch
git <b>rebase</b> master</pre>
</section>
<section>
<h2>Rewind History</h2>
<div>Undo the previous commit:</div>
<pre>git <b>reset</b> HEAD~</pre>
<div>Undo the previous two commits:</div>
<pre>git <b>reset</b> HEAD~2</pre>
<aside class="notes">
<div>There's also the <code>--soft</code> and <code>--hard</code>
modes, but we won't get into those here, since it can get a bit
involved. If you're really curious, and like diagrams, then try
<a href="http://git-scm.com/2011/07/11/reset.html">this</a>
detailed explanation.</div>
</aside>
</section>
<section>
<h2>Heavy-Duty History Rewriting</h2>
<div>Reorder, edit, reword, drop, split, combine history.</div>
<pre>git <b>rebase -i</b></pre>
<div>This is <i>interactive</i> — it will open an editor with
a list of your commits along with instructions.</div>
<aside class="notes">
Y'know, for winners.
</aside>
</section>
<section>
<h2>Repository Maintenance</h2>
<div>Save disk space by clearing out stuff that's no longer important.</div>
<div><br></div>
<div>Clean out old deleted upstream branches:</div>
<pre>git <b>remote prune</b> origin</pre>
<div>Clean out abandoned commits, recompress files, and much more:</div>
<pre>git <b>gc</b></pre>
<aside class="notes">
There's also the <code>--aggressive</code> option to <b>gc</b> for
those who are truly desperate to reclaim as much space as possible.
</aside>
</section>
<section data-state="soothe">
<h1>Question Time</h1>
</section>
<section data-state="soothe">
<section>
<h1>Fork This<br>Presentation</h1>
<div><a href="http://github.com/ZoogieZork/Git-Intro">http://github.com/ZoogieZork/Git-Intro</a></div>
</section>
<section>
<div><img src="res/qr-url.png" alt=""></div>
<div><a href="http://github.com/ZoogieZork/Git-Intro">http://github.com/ZoogieZork/Git-Intro</a></div>
</section>
</section>
<section data-state="blackout">
<h1>Advanced ± Topics</h1>
<p><i>Also known as "further reading".</i></p>
<aside class="notes">
<p>If you've found this section, then congratulations! You're in for a
magical world of refspecs, indexes, and... er...</p>
<p>Actually, no, this is more of just an overview of advanced topics
for another time that I threw in at the last minute.</p>
</aside>
</section>
<section>
<section>
<h2>Bringing Repositories Together</h2>
<h3>Submodules</h3>
<pre>git <b>submodule add</b> <i>repo</i> <i>dir</i></pre>
<div><i>Embeds</i> a separate repository as <i>dir</i>.</pre>
<div><br></div>
<div>The repository is kept separate.</div>
</section>
<section>
<h2>Bringing Repositories Together</h2>
<h3>Subtree</h3>
<pre>git <b>subtree add</b> --prefix <i>dir</i> <i>repo</i> <i>branch</i></pre>
<div><i>Merges</i> a separate repository as <i>dir</i>.</div>
<div><br></div>
<div>The full history of the repository is pulled in, as if it had
always been a part of your project, living at that directory.</div>
</section>
</section>
<section>
<section>
<h2>Find That One Bad Commit</h2>
<div>Given a good commit and a later bad commit, interactively find the
commit that caused all the trouble:</div>
<pre>git <b>bisect start</b>
git <b>bisect good</b> <i>good-commit</i>
git <b>bisect bad</b> <i>bad-commit</i></pre>
</section>
<section>
<h3>Bisect Through History</h3>
<div>Run your tests and either mark the current revision as good:</div>
<pre>git <b>bisect good</b></pre>
<div>… or bad:</div>
<pre>git <b>bisect bad</b></pre>
<div>… until there are no more revisions to check and Git
tells you which commit was the culprit.</div>
</section>
<section>
<h3>End the Bisect Session</h3>
<pre>git <b>bisect reset</b></pre>
</section>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
</body>
</html>