-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
428 lines (367 loc) · 11.2 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>git stuff</title>
<meta name="description" content="git stuff">
<meta name="author" content="Leif Bladt">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="css/reveal.min.css">
<link rel="stylesheet" href="css/theme/default.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h1>git stuff</h1>
</section>
<section>
<h2>De-centralized? I'm alone</h2>
<pre><code data-trim contenteditable>
$ git init
</code></pre>
<ul>
<li>Useful for small side-projects</li>
</ul>
</section>
<section>
<h2>Was that me?!?</h2>
<pre><code data-trim contenteditable>
$ git stash
$ mvn clean install
</code></pre>
</section>
<section>
<h2>What is the stash?</h2>
<p>Just a simple stack of diffs</p>
<pre><code data-trim contenteditable>
$ git stash
$ ...
$ git stash pop/apply
</code></pre>
</section>
<section>
<h2>Local changes</h2>
<pre><code data-trim contenteditable>
$ git stash
$ git pull
$ git stash pop
</code></pre>
</section>
<section>
<h2>Stashes are "invisible"</h2>
<p>Sometimes use temporary commits</p>
<pre><code data-trim contenteditable>
$ git ci -a -m "TEMP COMMIT"
</code></pre>
</section>
<section>
<h2>Staging</h2>
<p class="fragment">I don't use it all.</p>
</section>
<section>
<h2>Changing history</h2>
</section>
<section>
<h2>Typo in commit message</h2>
<pre><code data-trim contenteditable>
$ git ci --amend
</code></pre>
</section>
<section>
<h2>Forgot important file</h2>
<pre><code data-trim contenteditable>
$ git add important.txt
$ git ci --amend
</code></pre>
</section>
<section>
<h2>Cleanup the mess</h2>
<p>Interactive rebase</p>
<pre><code data-trim contenteditable>
$ git rebase -i HEAD~3
</code></pre>
<pre><code data-trim contenteditable>
pick 44d9981 Add log output to message listener
pick 55ae509 Add missing case in PssDispatcher
pick 993b06c Update product mock
# Rebase 52257d8..77ca559 onto 52257d8
#
# 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
</code></pre>
</section>
<section>
<h2>Nice try…</h2>
<ul>
<li class="fragment">Remove last commit
<pre><code data-trim contenteditable>
$ git reset --hard HEAD~1
</code></pre>
</li>
<li class="fragment">Undo last commit
<pre><code data-trim contenteditable>
$ git reset HEAD~1
</code></pre>
</li>
<li class="fragment">Revert a commit
<pre><code data-trim contenteditable>
$ git revert 7345jf0
</code></pre>
</li>
<li class="fragment">Undo local (uncommitted) changes
<pre><code data-trim contenteditable>
$ git checkout -- <file>
</code></pre>
</li>
</section>
<section>
<h2>Attention</h2>
<p>Don't change commits already pushed to a remote</p>
</section>
<section>
<h2>Other stuff</h2>
</section>
<section>
<h2>Low-hanging fruits</h2>
<pre><code data-trim contenteditable>
$ git cherry-pick 77sdfj2
</code></pre>
<ul>
<li>Get just one commit from another branch</li>
<li>This is now a complete new commit (with its own hash)</li>
</ul>
</section>
<section>
<h2>This must be there for some time …</h2>
<pre><code data-trim contenteditable>
$ git bisect start
$ git bisect good <commit>
$ git bisect bad <commit>
$ git bisect good/bad
</code></pre>
</section>
<section>
<h2>Working with tags</h2>
</section>
<section>
<h2>Create local tag</h2>
<pre><code data-trim contenteditable>
$ git tag 12345
</code></pre>
</section>
<section>
<h2>Push tag</h2>
<pre><code data-trim contenteditable>
$ git push origin 12345
$ git push origin --tags
</code></pre>
</section>
<section>
<h2>Delete local tag</h2>
<pre><code data-trim contenteditable>
$ git tag -d 12345
</code></pre>
</section>
<section>
<h2>Delete remote tag</h2>
<pre><code data-trim contenteditable>
$ git push origin :refs/tags/12345
</code></pre>
</section>
<section>
<h2>Working with local branches</h2>
</section>
<section>
<h2>Create local branch</h2>
<pre><code data-trim contenteditable>
$ git checkout -b new_branch
</code></pre>
<p>Shortcut for:</p>
<pre><code data-trim contenteditable>
$ git branch new_branch
$ git checkout new_branch
</code></pre>
</section>
<section>
<h2>Delete local branch</h2>
<pre><code data-trim contenteditable>
$ git branch -d branch_to_delete
$ git branch -D branch_to_delete
</code></pre>
</section>
<section>
<h2>Merging into master</h2>
<ul>
<li>
Merge (merge commit or fast-forward merge)
<pre><code data-trim contenteditable>
$ git checkout master
$ git merge new_branch
</code></pre>
</li>
<li class="fragment">
Force fast-forward merge
<pre><code data-trim contenteditable>
$ git rebase master
$ git checkout master
$ git merge new_branch
</code></pre>
</li>
</section>
<section>
<h2>Working with remote branches</h2>
</section>
<section>
<h2>Checkout a remote branch</h2>
<pre><code data-trim contenteditable>
$ git checkout -b new_branch origin/new_branch
</code></pre>
</section>
<section>
<h2>Push local branch</h2>
<pre><code data-trim contenteditable>
$ git push origin new_branch
</code></pre>
</section>
<section>
<div>
<h2>Update local branch</h2>
<pre><code data-trim contenteditable>
$ git pull origin new_branch
</code></pre>
<p>Shortcut for:</p>
<pre><code data-trim contenteditable>
$ git fetch
$ git merge origin/new_branch
</code></pre>
</div>
<div class="fragment">
<p>Rebase local changes</p>
<pre><code data-trim contenteditable>
$ git pull --rebase origin new_branch
</code></pre>
<p>Config hint:</p>
<pre><code data-trim contenteditable>
$ git config --global pull.rebase true (git >= 1.7.9)
</code></pre>
</div>
</section>
<section>
<h2>Delete remote branch</h2>
<pre><code data-trim contenteditable>
$ git push origin :branch_to_delete
</code></pre>
</section>
<section>
<h2>Tracking branches</h2>
<p>Relationship between a local and a remote branch</p>
<pre><code data-trim contenteditable>
$ git checkout --track origin/new_branch
$ git pull
$ git push
</code></pre>
<p>Config hint:</p>
<pre><code data-trim contenteditable>
$ git config --global push.default simple
</code></pre>
</section>
<section>
<h2>Changes from others</h2>
<p>Without changing anything so far</p>
<pre><code data-trim contenteditable>
$ svn st -u
</code></pre>
<pre><code data-trim contenteditable>
$ git fetch
$ git log origin/master..master --oneline
</code></pre>
</section>
<section>
<h2>UI for git</h2>
<ul>
<li>IntelliJ IDEA</li>
<li>GitHub for Mac</li>
</ul>
</section>
<section>
<h2>Attention</h2>
<h3>Line-endings</h3>
<p>Linux vs. Mac vs. Windows</p>
</section>
<section>
<h2>Resources</h2>
<ul>
<li><a href="http://gitimmersion.com/">http://gitimmersion.com/</a></li>
<li><a href="http://book.git-scm.com/">http://book.git-scm.com/</a></li>
<li><a href="http://gitready.com/">http://gitready.com/</a></li>
<li><a href="http://nathanhoad.net/how-to-delete-a-remote-git-tag">http://nathanhoad.net/how-to-delete-a-remote-git-tag</a></li>
<li><a href="http://www.paulboxley.com/blog/2011/06/git-caret-and-tilde">http://www.paulboxley.com/blog/2011/06/git-caret-and-tilde</a>
</ul>
</section>
<section>
<h2>Don't wait for it …</h2>
<pre><code data-trim contenteditable>
$ git init
</code></pre>
</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: false,
progress: true,
history: true,
center: true,
theme: Reveal.getQueryHash().theme || 'sky', // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'fade', // default/cube/page/concave/zoom/linear/fade/none
// Parallax scrolling
// parallaxBackgroundImage: 'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg',
// parallaxBackgroundSize: '2100px 900px',
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.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; } }
]
});
</script>
</body>
</html>