-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitprez.html
361 lines (283 loc) · 10.8 KB
/
gitprez.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
<!DOCTYPE html>
<html>
<head>
<title>git intro</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css">
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
body { font-family: 'Droid Serif'; }
h1, h2, h3 {
font-family: 'Yanone Kaffeesatz';
font-weight: normal;
}
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
</style>
</head>
<body>
<textarea id="source">
class: center, middle
# git!
---
class: center, middle
# git!
???
<!--
Notes for the _first_ slide!
[NOTE]: Note that you need remark.js alongside this html file, but no internet connection.
-->
---
#Co to git?
### Greatly Improve your Toolchain
Program, protokół do budowania, oznaczania, porównywania, wymiany z innymi wersjami czegoś
Czyli w sumie do wszystkiego
---
### Nazewnictwo
--
* diff, patch, chunk
<pre style="font-size: 50%">
<span style="font-weight:bold;">diff −−git a/behavior.go b/behavior.go</span>
<span style="font-weight:bold;">index 4a0ad38..0b99071 100644</span>
<span style="font-weight:bold;">−−− a/behavior.go</span>
<span style="font-weight:bold;">+++ b/behavior.go</span>
<span style="color:teal;">@@ −55,8 +55,8 @@</span> func fHome(ui *ui) {
func fEnter(ui *ui) {
	nl := <span>[</span>]rune{}
<span style="color:red;">−	for _, ch := range ui.lines<span>[</span>ui.cy] {</span>
<span style="color:red;">−		if ch != '\t' {</span>
<span style="color:green;">+</span>	<span style="color:green;">for i, ch := range ui.lines<span>[</span>ui.cy] {</span>
<span style="color:green;">+</span>		<span style="color:green;">if i >= ui.cx || ch != '\t' {</span>
			break
		}
		nl = append(nl, ch)
<span style="color:teal;">@@ −99,10 +99,13 @@</span> func delWord(ui *ui) {
	for ui.cx+d+1 < n && !ui.posSpace(ui.cx+d+1) {
		d++
	}
<span style="color:red;">−	if ui.cx > 0 && ui.cx+d+1 < len(ui.lines<span>[</span>ui.cy]) && ui.posSpace(ui.cx−1) && ui.posSpace(ui.cx+d+1) {</span>
<span style="color:red;">−		// remove also one of spaces</span>
<span style="color:red;">−		d++ // when there are multiple ones around</span>
<span style="color:green;">+</span>	<span style="color:green;">// delete also all but one space after word</span>
<span style="color:green;">+</span>	<span style="color:green;">after := 0</span>
<span style="color:green;">+</span>	<span style="color:green;">for ui.cx+d+1 < n && ui.posSpace(ui.cx+d+1) {</span>
<span style="color:green;">+</span>		<span style="color:green;">d++</span>
<span style="color:green;">+</span>		<span style="color:green;">after = 1</span>
	}
<span style="color:green;">+</span>	<span style="color:green;">d −= after</span>
	ui.lines<span>[</span>ui.cy] = append(ui.lines<span>[</span>ui.cy]<span>[</span>:ui.cx], ui.lines<span>[</span>ui.cy]<span>[</span>ui.cx+d+1:]...)
}
<span style="color:teal;">@@ −235,6 +238,11 @@</span> func defMap() map<span>[</span>key]func(*ui) {
		key{key: termbox.KeyArrowRight}: func(ui *ui) { ui.horizMove(1) },
		key{key: termbox.KeyCtrlK}: delLine,
		key{key: termbox.KeyCtrlU}: undelLine,
<span style="color:green;">+</span>		<span style="color:green;">key{key: termbox.KeyCtrlO}: func(ui *ui) {</span>
<span style="color:green;">+</span>			<span style="color:green;">delLine(ui)</span>
<span style="color:green;">+</span>			<span style="color:green;">fEnter(ui)</span>
<span style="color:green;">+</span>			<span style="color:green;">ui.horizMove(−1)</span>
<span style="color:green;">+</span>		<span style="color:green;">},</span>
		key{key: termbox.KeyCtrlE}: func(ui *ui) {
			ui.lines = <span>[</span>]<span>[</span>]rune{<span>[</span>]rune{}}
			ui.cx = 0
</pre>
---
### Nazewnictwo
* diff, patch, chunk (hunk)
--
* commit
<pre style="font-size: 70%">
<span style="color:olive;">commit b58e35ee4b23691d38b8dbaef52414a00d9d9339</span>
Author: Alexander Matthes <span><</span>[email protected]>
Date: Wed Oct 2 14:42:59 2019 +0200
Added .gitignore
<span style="font-weight:bold;">diff −−git a/.gitignore b/.gitignore</span>
<span style="font-weight:bold;">index c5964a0..58cb1ec 100644</span>
<span style="font-weight:bold;">−−− a/.gitignore</span>
<span style="font-weight:bold;">+++ b/.gitignore</span>
<span style="color:teal;">@@ −1,2 +1,3 @@</span>
aha
/.project
<span style="color:green;">+</span><span style="color:green;">/testcases/*</span>
</pre>
--
* patchset - wiele patchy (commitow), zamieszczonych jeden pod drugim
--
* repozytorium (repo) - baza kodu, wszystko razem
---
#Interfejs
konsola to podstawa, ale sa tez graficzne narzedzia
git komenda pliki wersje
---
# git config
nazwa, email, jest lokalne=per projekt i globalne
git config --global user.name "Przemek Przykładowy"
stworzenie globalnego na linuksie, plik: `~/.gitconfig`
[user]
email = [email protected]
name = Przemek Kitszel
[push]
default = simple
--
[credential]
helper = store
[diff]
algorithm = histogram
---
#Nowe repo
(najpierw idziemy do ladnie nazwanego folderu)
git init
przydatne w malych projektach
---
#git add
---
#\#!/bin/bash
pauza, troche bash'a, ., root, uzytkownicy, *, quote, ENV, EDITOR, historia, ...
---
#git commit
git commit -a
git commit -m 'raczej nie'
---
#git log
git log
git log --oneline
tig
gitk
git log --graph --oneline --date=human
---
# Koncepcja STAGE / INDEX / CACHE
git diff
git diff --cached
git status
git status -s
---
# nie tylko git add
git rm
git mv
### .gitignore
git restore # od gita 2.23, łatwo sie pobawić w dockerze tym
git switch # od gita 2.23, łatwo sie pobawić w dockerze tym
git reset
git checkout
<pre style="font-size: 50%">
<span>#</span> dodanie aliasu na najnowszy git, wystarczy raz,
<span>#</span> (bedzie w nowych terminalach, przy pierwszym uzyciu zaciaga pliki)
echo "alias git24='docker run -ti --rm -v \"\$(pwd)\":/root -w /root -v \$HOME/.ssh:/root/.ssh bitnami/git:2.24.0'" \<br>	>> ~/.bashrc && source .bashrc</pre>
---
#git show
git show
git show --name-only
---
#git tag
* lekki, po prostu taki jakby alias na commit (lub cos innego niz commit)
* pelny, annotated - zawiera date, autora, komentarz
git tag lekki-tag 53ea558585
git tag -a lepszy-tag f385887c0f
<pre style="font-size: 50%">
<span style="color:olive;">commit 53ea558585bdd05d27e401025d09720d47c9de26</span> (tag: lekki-tag)
Author: Przemek Kitszel <span><</span>[email protected]>
Date: Thu Nov 28 01:03:13 2019 +0100
Describe minimum line history building skills
<span style="font-weight:bold;">diff −−git a/gitprez.html b/gitprez.html</span>
<span style="font-weight:bold;">index 3a84934..e9d61ab 100644</span>
<span style="font-weight:bold;">−−− a/gitprez.html</span>
<span style="font-weight:bold;">+++ b/gitprez.html</span>
<span style="color:teal;">@@ −150,6 +150,35 @@</span> stworzenie globalnego na linuksie, plik: `~/.gitconfig`
	<span>[</span>diff]
		algorithm = histogram
<span style="color:green;">+</span><span style="color:green;">−−−</span>
<span style="color:green;">+</span><span style="color:green;">#Nowe repo</span>
<span style="color:green;">+</span><span style="color:green;">(najpierw idziemy do ladnie nazwanego folderu)</span>
<span style="color:green;">+</span>
<span style="color:green;">+</span>	<span style="color:green;">git init</span>
<span style="color:green;">+</span><span style="color:green;">przydatne w malych projektach</span>
(...)
</pre>
---
#git tag
* lekki, po prostu taki jakby alias na commit (lub cos innego niz commit)
* pelny, annotated - zawiera date, autora, komentarz
git tag lekki-tag 53ea558585
git tag -a lepszy-tag f385887c0f
<pre style="font-size: 50%">
<span style="color:olive;">tag lepszy−tag</span>
Tagger: Przemek Kitszel <span><</span>[email protected]>
Date: Thu Nov 28 01:20:35 2019 +0100
Pelny opis
<span style="color:olive;">commit f385887c0f6167045c6f7411b4fd708608f87465</span> (tag: lepszy-tag)
Author: Przemek Kitszel <span><</span>[email protected]>
Date: Thu Nov 28 00:52:27 2019 +0100
Describe git config
<span style="font-weight:bold;">diff −−git a/gitprez.html b/gitprez.html</span>
<span style="font-weight:bold;">index 835e332..3a84934 100644</span>
<span style="font-weight:bold;">−−− a/gitprez.html</span>
<span style="font-weight:bold;">+++ b/gitprez.html</span>
<span style="color:teal;">@@ −132,6 +132,25 @@</span> konsola to podstawa, ale sa tez graficzne narzedzia
	git komenda pliki wersje
<span style="color:green;">+</span><span style="color:green;">−−−</span>
<span style="color:green;">+</span><span style="color:green;"># git config</span>
<span style="color:green;">+</span><span style="color:green;">nazwa, email, jest lokalne=per projekt i globalne</span>
(...)
</pre>
---
#HEAD
git reflog
git checkout --detach
git checkout lekki-tag
---
#git branch
czyli tag ktory podaza
git checkout -b nowy-branczA # to trzeba zapamietac
git switch -c nowy-branczB # od gita 2.23
git branch save123
---
# przerwa?
---
# git merge
git merge skąd
git merge --squash
git merge --no-ff
git merge --ff-only
mogą być konflikty, ale przy innych komendach również
---
#Zdalne repo
git remote # show
git remote add upstream
git remote add origin # raczej juz jest, kto zgadnie skąd nazwa?
git remote add labintel
git clone https://github.com/pkitszel/small.git
git clone [email protected]:pkitszel/small.git
git clone -b
git clone --depth 100
git branch -r
git fetch
git fetch origin
git push
---
# git rebase
git rebase
git rebase -i
git commit --fixup
git commit -a --fixup=:/'Fragment jakiegos commit message'
---
#!git
pierwszy slajd od nowa
graf, manipulacja
---
#warsztat2
* cofanie z indexu
* checkout konkretnego pliku
* zrob mnie jak na zdalnym repie
* komendy nieporuszone:
git revert
git clean -xdf
git stash
git range-diff
</textarea>
<script src="remark.min.js" type="text/javascript">
</script>
<script type="text/javascript">
var slideshow = remark.create();
</script>
</body>
</html>