Repository navigation
Expand file tree
/
Copy pathday1.txt
More file actions
540 lines (469 loc) · 12.2 KB
/
Copy pathday1.txt
File metadata and controls
540 lines (469 loc) · 12.2 KB
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
520
521
522
523
524
525
526
1 2 3 4 5 6 7 8 9
======================
8105843520
======================
Demo - Laptop + Github.com
Lab - Laptop + Github.com
================================
Start @ - 9:30 AM IST - 5:30 PM IST
================================
Lunch Time - 1:00 - 2:00 PM
================================
2 Break - Tea - Coffee - Rest - 15 mins each
--------------------------------------------
11:30 - for 15 mins
3:30 - for 15 mins
==================================
During Demo -
==================================================
What is Git?
=========================
Source Code mgmt tool
Versioning Tool for the code
Open Source
Free
Compat with All OS.
Written in C.+++
Written by Linus Tovarld
- Father of LINUX.
- Reason for git - Bitkeeper (Distributed version control system)
Apache2 License
2004*** First release
is DISTRIBUTED
What is Versioning?
-------------------
I want to know some info on the CODE?
--------------------------
When this code was written?
What code has been written?
Who has written?
Where a code is located?
Why this code is written?
======================
V1.txt V2.txt V3.txt ==>
What is Code?
-------------------------
Can be open with NOTEPAD.
css html java python js .txt
What is Not Code?
-------------------------
Images, PDF, Movie, Doc
===================================================
Other tools -
OS & Free - RCS -> CVS -> SVN -> GIT
Prop -> VSS -> Perforce -> ClearCase -> TFS -> AzureDevOps -> Mercury
===================================================
GIT IS TRULY DISTRIBUTED
-----------
===================================================
Who can use git?
----------------
ANY ONE and Everyone who wants...
When this code was written?
What code has been written?
Who has written?
Where a code is located?
Why this code is written?
==============================================================
What is Server-Client?
--------------------
OS & Free - RCS -> CVS -> SVN
Prop -> VSS -> Perforce -> ClearCase -> TFS -> Mercury
What is DISTRIBUTED?
--------------------
Git
========================================================
========================================================
How to install git?
==============================
https://git-scm.com/downloads/guis
WINDOWS - EXE - https://git-scm.com/
- git gui - Ok for basic visualization
- git bash - very good tool. git + basic linux commands in windows.
- git cmd [ Dep ]
MAC - DMG - https://git-scm.com/
LINUX -
Exec
Repo Based
DEBIAN - sudo apt-get install git -y
RHEL - sudo yum install git -y
==============================================================
Lab - 15 mins
==============================================================
==============================================================
Workflow
Add a file(s)
Change a file(s)
Delete a file(s)
version a file
See a history
Basic Workflow in Git?
=========================================
Step 1 - Create a Repo [ ONE time ]
$ git init
Step 2 - Create a file(s) in Workspace using editor
Step 3 - Add a file to GIT repo [ Add a file from Working dir to Staging area]
$ git add file1.java
[ONE TIME]
$ git config user.name "Rajesh Kumar"
$ git config user.email "devops@rajeshkumar.xyz"
$ git config --list
Step 4 - Commit a file to Git repo [ From Staging area to Repo ]
$ git commit -m"First Code for Demo"
Rajesh Kumar@DESKTOP-6KRAAR8 MINGW64 /e/vesta/repo1 (master)
$ git commit -m"First Code for Demo"
[master (root-commit) 19f5b07] First Code for Demo
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 file1.java
Step 5 - See a history/version
$ git log
$ git show 19f5b0703006a776b8097ae2dc7811220261dfd6
=========================================
$ git log
commit 19f5b0703006a776b8097ae2dc7811220261dfd6 (HEAD -> master)
Author: Rajesh Kumar <devops@rajeshkumar.xyz>
Date: Thu Jul 23 11:52:19 2020 +0530
First Code for Demo
=========================================
What is 19f5b0703006a776b8097ae2dc7811220261dfd6?
- a 40 Char universal uniq ID -
- Called CHECKSUM aka commit-id aks revision
- SHA1
- Link to the CODE which you commited in repo.
- Size of each commit can be anything.
- each commit ID has parent ID [ RelationShip]
tecnology - Object Storage
- Google Drive
- S3
- git
- Docker
==============================================
What is Staging area?? and where is that?
Working Dir - A Place where you write/change a code.
- /e/vesta/repo1
Staging Area - A Place where you can
- SEE DIFf Between WORKSPACE and REPO
- Help you to send a file from WorkSpace to repo.
- - /e/vesta/repo1/.git/index
- git status
Repo - A Place where you store a version after a commit.
- /e/vesta/repo1/.git/objects
================================================
==================Finalizing a place to work with versioning==============================
509 cd /e
510 pwd
511 start .
512 cls
513 clear
514 mkdir vesta
515 cd vesta/
516 mkdir repo1
517 ls
518 cd repo1/
519 clear
520 pwd
521 start .
522 clear
523 ls
524 history
=================Basic work flow===============================
527 git init
528 start .
529 touch file3.css
530 touch file4.js
531 clear
532 ls
533 git add file1.java
534 git config user.name "Rajesh Kumar"
535 git config user.email "devops@rajeshkumar.xyz"
536 git config --list
537 clear
538 git commit -m"First Code for Demo"
539 clear
540 git log
541 git show 19f5b0703006a776b8097ae2dc7811220261dfd6
542 history
543 clear
544 git log
545 pwd
546 cd .git/
547 pwd
548 clear
549 pwd
550 ls
551 cd index
552 sl
553 clear
554 ls
555 cd objects
556 ls
557 clear
558 ls
559 cd ..
560 clear
561 ls
562 cd ..
563 ls
564 clear
565 git log
566 git show 19f5b0703006a776b8097ae2dc7811220261dfd6
567 clear
==================Status -- Staging area==============================
571 git status
572 clear
573 git status
574 ls
575 clear
576 git add .
577 git status
578 ls
579 clear
580 git status
581 git commit -m"adding all files"
582 clear
583 git status
584 ls
585 clea
586 clear
587 vi file1.java
588 git status
589 git add .
590 git status
591 git commit -m"adding a file changed in file1.java"
592 clear
593 git status
594 ls
595 git log
596 clear
597 history
============================================
============================================
Qs -
How to rename a file?
How to commit a dir?
How to move a file from one location to another location?
How to add all file but commit only selected file?
How to delete files?
How to delete dir?
How to get back to the stage of before deleted file?
-------ADD a New file/content---------
git add
git commit
----------------
-------Rename a New file---------
Rename manually # git mv fileaname1.txt filename2.txt
git add # git mv fileaname1.txt filename2.txt
git commit
or
git mv fileaname1.txt filename2.txt
git commit
----------------
628 git status
629 clear
630 ls
631 git mv file4.js file44.js
632 git status
633 git commit -m"renmaing a file"
634 clear
635 git status
636 ls
637 clear
638 ls
639 mkdir src
640 clear
641 ls
642 git status
643 touch file5.txt
644 git status
645 clear
646 ls
647 git status
648 touch src/file6.txt
649 clear
650 git status
651 git add .
652 clear
653 git status
654 git commit -"selective commit" src/file6.txt
655 clear
656 git commit m-"selective commit" src/file6.txt
657 git commit -m "selective commit" src/file6.txt
658 git status
659 clear
660 ls
661 git status
662 ls
663 git mv file2.py src/
664 clear
665 git status
666 git commit -m"move a file location"
667 ls
668 git status
669 clear
670 git status
671 clear
672 ls
673 git rm file1.java
674 git status
675 ls
676 clear
677 git status
678 ls
679 git commit -m"deleting file"
680 git status
681 clear
682 ls
683 clear
684 git log
685 ls
686 git log
687 git log --oneline
688 clear
689 git log --oneline
690 ls
691 clear
692 git status
693 git log --oneline
694 git checkout dc1729f
695 clear
696 ls
697 git checkout master
698 ls
699 git log --oneline
700 clear
701 git log --oneline
702 git checkout 19f5b07
703 ls
704 clear
705 git checkout 19f5b07
706 git checkout master
707 ls
708 git checkout 19f5b07
709 clear
710 ls
711 git checkout master
712 clear
713 history
=================
vi - editor - default in linux
Mode -
Read only (Default) - Save and QUIT
exit without
:q!
exit and saving
:wq
Insert Mode --- press i - Write
=================
=====================================================================
Qs
------------
How do we share code with each other?
---------------------------------------
- Git allows you connect with any other remote repo using
- ssh [ Remote repo machine should be enabled with ssh and network ]
- http [ Remote repo machine should be enabled with http server and network ]
- To Send your commits from Local repo to remote repo - PUSH
-------
- To get commits fron remote repo to local repo - PULL
-------
Basic workflow working with remote repo
===========================================
First time - Clone a remote repo
Seconds time onwards
- To Send your commits from Local repo to remote repo - PUSH -------
- To get commits fron remote repo to local repo - PULL
-------
Enterprises started looking for
- WIKI Integ with [Remote and Central Repo]
- Issues tracking
- Mul Org and Mul Projects
- Role based Mach.
- GUI
- Abilility to manage mul repo.
------------------------
GIT says- NO......We do not have this featuree
Startups in Git
============================
I would make GIT enterprise ready
- github
cloud - hosted for PUBLIC - Free + Paid
enterprise - hosted for YOUR COMPANY WITHIN FIREWALL + Paid
- gitlab
- bitbucket
- Amazon
- Google
- microsoft
- Gerrit
================
- Hosting platform DONE
- has Remote repo DONE
- has central repo DONE
- WIKI Integ with [Remote and Central Repo]
- Issues tracking
- Mul Org and Mul Projects
- Role based access mach
- LDAP auth
- GUI
- Abilility to manage mul repo.
===================================================
Workflow working with Github
======================================
USER 1
===================
Step 1- Register at github cloud (github.com)
Step 2 - create a empty repo
https://github.com/devopsschool-demo-temporary/vestademo
Step 3 - Push your Existing repo
git push https://github.com/devopsschool-demo-temporary/vestademo.git master
USER 2
===================
Step 1- Register at github cloud (github.com)
Step 2 - Clone Team repo
Step 3 - Create a file(s) in Workspace using editor
Step 4 - Add a file to GIT repo [ Add a file from Working dir to Staging area]
$ git add file1.java
Step 5 -
[ONE TIME]
$ git config user.name "Rajesh Kumar"
$ git config user.email "devops@rajeshkumar.xyz"
$ git config --list
Step 6 - Commit a file to Git repo [ From Staging area to Repo ]
$ git commit -m"First Code for Demo"
Rajesh Kumar@DESKTOP-6KRAAR8 MINGW64 /e/vesta/repo1 (master)
$ git commit -m"First Code for Demo"
[master (root-commit) 19f5b07] First Code for Demo
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 file1.java
Step 7 - See a history/version
$ git log
$ git show 19f5b0703006a776b8097ae2dc7811220261dfd6
Step 8 - PUSH your commit to remote/central github repo
USER 1
===================
Pull a updated code from uSER2 from remote/central github repo
USER1
-----------
501 git push https://github.com/devopsschool-demo-temporary/vestademo.git master
502 git log --oneline
503 clear
504 ls
505 ls
506 git pull origin master
507 git remote add origin https://github.com/devopsschool-demo-temporary/vestademo.git
508 git pull origin master
509 ls
510 history
USER2
-----------
501 git clone https://github.com/devopsschool-demo-temporary/vestademo.git user2
502 ls
503 cd user2
504 clear
505 ls
506 git log --oneline
507 ls
508 clear
509 ls
510 touch user2.txt;git add .;git commit -m"adding as a user2"
511 git push origin master
512 history