-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
400 lines (295 loc) · 15.9 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
<!DOCTYPE html>
<html>
<head>
<!--How code being decoded-->
<meta charset = "utf-8">
<!--How page being display based on viewport-->
<meta name = "viewport" content = "width = device-width, initial-scale = 1 shrink-to-fit = no">
<!--Add author, web description, keywords for search engine, and copyright-->
<meta name = "author" content = "Yip Zi Xian | Nightfury">
<meta name = "description" content = "Git GitHub Workshop">
<meta name = "keywords" content = "Yip Zi Xian, YZX, Git, GitHub, Bash">
<meta name = "copyright" content = "Copyright 2023 Yip Zi Xian ">
<!--Link to CSS-->
<link rel = "stylesheet" href = "style.css">
<!--Link to Google Font-->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@200;400;600;800&display=swap" rel="stylesheet">
<!--Link to Pictures file-->
<link rel = "icon" type = image/png href = Git_GitHub_Workshop.png>
<!--Title-->
<title>Git GitHub Workshop</title>
</head>
<body>
<div class="main-container">
<div class="image-container">
<img src="Cover_Image.png" />
</div>
<h1>Git GitHub Workshop Sheet</h1>
<div class="content-container">
<div class="content">
<h3>Cloning repository</h3>
<h5>The easiest one. Nothing can go wrong with this.</h5>
<br/>
<h5>1. Go to any repository, press the "Code" (The blue button).</h5>
<br/>
<h5>2. Select either HTTPS or SSH.</h5>
<sup>NOTE: Make sure you have configured your SSH key before cloning it via SSH.</sup>
<br/>
<h5>3. Go to any folder directory you wish using Command Prompt or Powershell or Git Bash.</h5>
<p>cd "your folder"</p>
<p>git clone "copied link / copied ssh"</p>
<sup>NOTE: It will automatically create a folder for you.</sup>
<p>git clone "copied link / copied ssh" .</p>
<sup>NOTE: If you created a folder for the repository, add a dot behind.</sup>
</div>
<div class="content">
<h3>Forking repository</h3>
<h5>Basically duplicating a repository from others.</h5>
<br/>
<h5>1. Go to any repository, press the "Fork" (Top right corner).</h5>
<br/>
<h5>2. Leave everything as default. You may change the repository name as the forked repository will be at your disposal.</h5>
<sup>NOTE: You can't fork your own repository in the same account.</sup>
</div>
<div class="content">
<h3>Creating repository</h3>
<h5>New project in the house.</h5>
<br/>
<h5>1. Go to your repository tab, press the "New" (Yes, the blue button).</h5>
<br/>
<h5>2. Name your repository and provide a description for it.</h5>
<br/>
<h5>3. Choose the repository visibility: Public OR Private.</h5>
<br/>
<h5>4. Choose MIT License as default if you want your repository as open-sourced.</h5>
<sup>NOTE: License is like a copyright to your code.</sup>
<br/>
<h5>5. Press the "Create repository" (Yes, blue button again) and your repository is created.</h5>
</div>
<div class="content">
<h3>Checking status</h3>
<h5>Have a sense of security, ehe.</h5>
<br/>
<h5>1. Open Command Prompt or Powershell or Git Bash and go to your repository folder path.</h5>
<p>cd "your folder"</p>
<br/>
<h5>2. To know what file created, added, modified, deleted, and which branches you are currently in.</h5>
<p>git status</p>
</div>
<div class="content">
<h3>Reverting changes</h3>
<h5>Thinking of undoing everything, just snap your fingers. I mean stash your repository.</h5>
<br/>
<h5>1. Open Command Prompt or Powershell or Git Bash and go to your repository folder path.</h5>
<p>cd "your folder"</p>
<br/>
<h5>2. Clearing any created, added, modified, deleted files you made.</h5>
<p>git stash</p>
<sup>NOTE: It will revert back to the latest pull from main branch you have previously made.</sup>
</div>
<div class="content">
<h3>Uploading changes</h3>
<h5>Saving your edited codes to GitHub, cloud storage but cooler.</h5>
<br/>
<h5>1. Open Command Prompt or Powershell or Git Bash and go to your repository folder path.</h5>
<p>cd "your folder"</p>
<br/>
<h5>2. Include all files changed.</h5>
<p>git add --all</p>
<br/>
<h5>3. Write a commit message as a backlog.</h5>
<p>git commit -m "your message"</p>
<br/>
<h5>4. Upload all files to GitHub.</h5>
<p>git push origin main/master/"your branch name"</p>
<br/>
<h5>(Optional) 5. If you push from a branch, create a merge request so whoever in charge can have a code review before merging it to the main branch. There will be a link available in your terminal, just "Ctrl + Left Click" and it will redirect you to GitHub. Press on the "Create Pull Request" (YES, blue button! Again).</h5>
</div>
<div class="content">
<h3>Downloading changes</h3>
<h5>Make your repository up-to-date to the latest version.</h5>
<br/>
<h5>1. Open Command Prompt or Powershell or Git Bash and go to your repository folder path.</h5>
<p>cd "your folder"</p>
<br/>
<h5>2. Update your local file directory.</h5>
<p>git pull origin main</p>
<sup>NOTE: Always download from the main/master branch.</sup>
</div>
<div class="content">
<h3>Fetching branches</h3>
<h5>Similar to Pull, but it won't make changes to your local files. Recommended for developers to review other developers code before merging.</h5>
<br/>
<h5>1. Open Command Prompt or Powershell or Git Bash and go to your repository folder path.</h5>
<p>cd "your folder"</p>
<br/>
<h5>2. Fetch new branches.</h5>
<p>git fetch</p>
<br/>
<h5>3. Change to the newly fetch branches for code review remotely.</h5>
<p>git branch</p>
<sup>NOTE: This is to check the branches fetched and its name.</sup>
<p>git checkout "the branch"</p>
<br/>
<h5>(Optional) 4. If any changes are made in the fetched branch, update the changes back to the branch in GitHub.</h5>
<p>git add --all</p>
<p>git commit -m "your message"</p>
<p>git push origin "the branch"</p>
<sup>NOTE: This will update the branch for merging to the main/master branch later.</sup>
</div>
<div class="content">
<h3>Create a new branch</h3>
<h5>Don't touch the main branch if you want to keep your job.</h5>
<br/>
<h5>1. Open Command Prompt or Powershell or Git Bash and go to your repository folder path.</h5>
<p>cd "your folder"</p>
<br/>
<h5>2. Create a new branch along with the name.</h5>
<p>git checkout -b "new branch name"</p>
<sup>NOTE: Remember to avoid creating branches with same name. There are ... consequences ... world-ending consequences.</sup>
</div>
<div class="content">
<h3>Changing to another branch</h3>
<h5>Go back to where your codes belong.</h5>
<br/>
<h5>1. Open Command Prompt or Powershell or Git Bash and go to your repository folder path.</h5>
<p>cd "your folder"</p>
<br/>
<h5>2. Check your existing branches in local device.</h5>
<p>git branch</p>
<sup>NOTE: The branches available in your local devices may differ to branches in GitHub</sup>
<br/>
<h5>3. Go the existing branch.</h5>
<p>git checkout "branch name"</p>
<sup>NOTE: -b is not needed because you are not creating a new branch.</sup>
</div>
<div class="content">
<h3>Checking branches</h3>
<h5>See what branches you have in your local device.</h5>
<br/>
<h5>1. Open Command Prompt or Powershell or Git Bash and go to your repository folder path.</h5>
<p>cd "your folder"</p>
<br/>
<h5>2. Check your existing branches in local device.</h5>
<p>git branch</p>
<sup>NOTE: The branches available in your local devices may differ to branches in GitHub</sup>
</div>
<div class="content">
<h3>Deleting branches</h3>
<h5>Clearing old branches so you won't run out of branch naming ideas.</h5>
<br/>
<h5>1. Open Command Prompt or Powershell or Git Bash and go to your repository folder path.</h5>
<p>cd "your folder"</p>
<br/>
<h5>2. Checkout to the main branch.</h5>
<p>git checkout main/master</p>
<sup>NOTE: Always delete branches from your main branch.</sup>
<br/>
<h5>3. Check your existing branches in local device.</h5>
<p>git branch</p>
<sup>NOTE: The branches available in your local devices may differ to branches in GitHub</sup>
<br/>
<h5>4. Delete the branches in your local device. It won't affect the branches in GitHub.</h5>
<p>git branch -D "branch name"</p>
</div>
<div class="content">
<h3>Updating existing branches</h3>
<h5>Using back the same branch again and again is all right, but ...</h5>
<br/>
<h5>1. Open Command Prompt or Powershell or Git Bash and go to your repository folder path.</h5>
<p>cd "your folder"</p>
<br/>
<h5>2. Update your whole folder by pulling the main branch from GitHub to your local device.</h5>
<p>git pull origin main</p>
<br/>
<h5>3. Checkout to your existing branch, if you forgot, then check the branches you have.</h5>
<p>git branch</p>
<p>git checkout "the branch"</p>
<br/>
<h5>4. Update the branch you are in by pulling the main branch again.</h5>
<p>git pull origin main</p>
<sup>NOTE: This time it won't show any stuffs like created, added, modified, deleted, instead it will just show you something something FETCH_HEAD blah blah blah...</sup>
</div>
<div class="content">
<h3>Merging branches to main branch</h3>
<h5>Time to get your hands dirty with conflicts arising. ONLY FOR WHOEVER IN CHARGE.</h5>
<br/>
<h5>1. Go to your GitHub and click into your repository.</h5>
<br/>
<h5>2. Press "Pull Requests" and you will see all pull requests.</h5>
<sup>If there is no pull requests, you can create it manually.</sup>
<br/>
<h5>(Optional) 3. To create a new pull request, press "New Pull Request" (Blue button). Base branch will be your main branch and compare branch will be the branch you want to merge into your main branch.</h5>
<br/>
<h5>4. If there is any conflicts, click "Resolve conflicts". It will show your code and the codes overlapping it, you will need some time to check and clear it.</h5>
<sup>NOTE: Don't make your seniors' life harder when you are working.</sup>
<br/>
<h5>5. If there is no conflicts or resolved, click "Merge Request" and your main branch will be updated with new codes.</h5>
<br/>
<h5>(Optional) 6. You can delete the branch if you wish to. A button to delete the branch will appear after you merged sucessfully.</h5>
</div>
<hr class="hr-text" data-content="Optional Section"/>
<div class="content">
<h3>Creating SSH key</h3>
<h5>Extra protection, less frustration. What the heck were you thinking?</h5>
<br/>
<h5>1. Before proceeding, you can check your existing SSH keys if they exist.</h5>
<p>ls -al ~/.ssh</p>
<sup>NOTE: There are mostly .pub file.</sup>
<br/>
<h5>2. Open Git Bash, not other terminal.</h5>
<br/>
<h5>3. Generate a SSH key by replacing it with your GitHub email.</h5>
<p>ssh-keygen -t ed25519 -C "your GitHub email"</p>
<h5>If the above ed25519 algorithm can't be used, use the rsa algorithm.</h5>
<p>ssh-keygen -t rsa -b 4096 -C "your GitHub email"</p>
<br/>
<h5>4. It will prompt you:</h5>
<p>Enter a file in which to save the key: </p>
<h5>Retype the file path provided and replace the SSH keyname with whichever you like.</h5>
<p>id_"random keyname"</p>
<br/>
<h5>5. Set your password once and confirm it again.</h5>
<sup>NOTE: You can't see the password but it is written adn recorded.</sup>
<br/>
<h5>6. Start ssh-agent manually.</h5>
<p>eval "$(ssh-agent -s)"</p>
<h5>It will return your agent pid. It may differ from devices.</h5>
<p>Agent pid 59566</p>
<br/>
<h5>7. Add your SSH private key to the agent and replace the id with what you inputted in Step 4.</h5>
<p>ssh-add ~/.ssh/id_"random keyname"</p>
<br/>
<h5>8. Copy the SSH public key to your clipboard.</h5>
<p>clip < ./.ssh/id"random keyname".pub</p>
<br/>
<h5>9. Open your GitHub and go to "Profile" -> "Setting".</h5>
<br/>
<h5>10. Click "SSH and GPG keys" -> "New SSH key" / "Add SSH key".</h5>
<br/>
<h5>11. Set any title, leave the key type as "Authentication Key", paste in the SSH public key.</h5>
<sup>NOTE: Remove any whitespaces or empty rows.</sup>
<sup>NOTE: Your public SSH key should begin with the algorithmn name and ends with your email address.</sup>
<br/>
<h5>12. Press "Add SSH key" and your first SSH key is created.</h5>
<br/>
<h5>(Optional) 13. Test your SSH key connection.</h5>
<p>ssh -T [email protected]</p>
</div>
</div>
<footer>
<a href="https://github.com/NightfuryEquinn" target="_blank">
<h4>Written by Yip Zi Xian</h4>
</a>
<a href="https://discord.gg/2TUHh6XNYE" target="_blank">
<h4 class="footer">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-discord" viewBox="0 0 16 16"> <path d="M13.545 2.907a13.227 13.227 0 0 0-3.257-1.011.05.05 0 0 0-.052.025c-.141.25-.297.577-.406.833a12.19 12.19 0 0 0-3.658 0 8.258 8.258 0 0 0-.412-.833.051.051 0 0 0-.052-.025c-1.125.194-2.22.534-3.257 1.011a.041.041 0 0 0-.021.018C.356 6.024-.213 9.047.066 12.032c.001.014.01.028.021.037a13.276 13.276 0 0 0 3.995 2.02.05.05 0 0 0 .056-.019c.308-.42.582-.863.818-1.329a.05.05 0 0 0-.01-.059.051.051 0 0 0-.018-.011 8.875 8.875 0 0 1-1.248-.595.05.05 0 0 1-.02-.066.051.051 0 0 1 .015-.019c.084-.063.168-.129.248-.195a.05.05 0 0 1 .051-.007c2.619 1.196 5.454 1.196 8.041 0a.052.052 0 0 1 .053.007c.08.066.164.132.248.195a.051.051 0 0 1-.004.085 8.254 8.254 0 0 1-1.249.594.05.05 0 0 0-.03.03.052.052 0 0 0 .003.041c.24.465.515.909.817 1.329a.05.05 0 0 0 .056.019 13.235 13.235 0 0 0 4.001-2.02.049.049 0 0 0 .021-.037c.334-3.451-.559-6.449-2.366-9.106a.034.034 0 0 0-.02-.019Zm-8.198 7.307c-.789 0-1.438-.724-1.438-1.612 0-.889.637-1.613 1.438-1.613.807 0 1.45.73 1.438 1.613 0 .888-.637 1.612-1.438 1.612Zm5.316 0c-.788 0-1.438-.724-1.438-1.612 0-.889.637-1.613 1.438-1.613.807 0 1.451.73 1.438 1.613 0 .888-.631 1.612-1.438 1.612Z"/></svg>
Join my Z-E-N server
</h4>
</a>
</footer>
</div>
</body>
</html>