1 of 58

Preparation

1

app.sli.do/event/7MA9DDoeyu11QTWMAc33ME

2 of 58

101

2

3 of 58

Agenda 3.3.2024

1. Version Control System

2. Get started with Git�3. Basic commands�4. Git Workflow

5. Continuous Integration (CI) Introduction�6. Demo: CI/CD a Static Site Generator webpage

3

4 of 58

Version Control System

4

I'll in charge!

5 of 58

Why need using Git

5

Chinh's code

v1.0.0

v1.0.1

v1.0.2

Thang's code

v1.0.0

v1.0.1

v1.0.2

Before git

6 of 58

Centralized Version Control System

6

Single point of failure

Slow speed

Performance limitations

Doesn’t scale

Waste of resources

Centralized VCS

7 of 58

7

Chinh's code

v1.0.0

v1.0.1

v1.0.2

Thang's code

v1.0.0

v1.0.1

v1.0.2

v1.0.2

Before git

After git

8 of 58

8

9 of 58

What is Git?

9

Distributed SCM

Collaborative coding

10 of 58

Who made Git

10

Father of Linux

Linus Torvalds

Love penguins

11 of 58

Git as a Service

11

12 of 58

12

INSTALLATION

MacOS: brew install git�Debian: apt-get install git�Fedora: yum/dnf install git�Alpine: apk add git�Windows: https://git-scm.com/download/win�

https://git-scm.com/download

13 of 58

13

INSTALLATION

14 of 58

14

CHECK GIT VERSION

15 of 58

Getting Started with Github

15

16 of 58

16

GIT MUST-CONFIG

17 of 58

17

GENERATE SSH KEY

18 of 58

A Repository

18

Store source code of your one project

Recognized by .git folder

Local / Remote Repo

will be explain next slide

19 of 58

How Git works

19

20 of 58

Git Clone

20

= Download your repo

21 of 58

Add & Commit & Push

21

I want theses changes

Oh, I want that changes on my local

Ready to change for remote repo

22 of 58

Example: Update changes with 3 legends: add, commit, push

22

23 of 58

Example of .git

23

and I will show you what inside it

24 of 58

Fork

24

25 of 58

Git as a Service

25

https://sapling-scm.com/docs/introduction/

26 of 58

Lazygit

26

27 of 58

Practice repo

27

github.com/GDSC-HCMUS/GDSCxSAB-cs101-git

28 of 58

28

Tea Break & QnA

29 of 58

Git Workflow

29

Let me handle this…

30 of 58

The Three States of Git

30

3 states of local changes

Default branch checkout

31 of 58

Git Branch

31

Core power of Git

A copied version of your main code

Develop new feature, or bug fix

32 of 58

Git Branches Example

32

33 of 58

Checkout a branch

33

34 of 58

Pull Request = Request to update my changes from my branch

Pull Request Simple Explain

34

35 of 58

Pull Request Process

35

36 of 58

Pull Request Process

36

Review code

Open PR

Approve PR

= Updated changes

37 of 58

Pull Request (PR) Example

37

38 of 58

Pull Request (PR) Example

38

PR title and PR number

Who open PR and what they changes

39 of 58

Pull Request (PR) Example

39

Source branch and dest branch

Reviewer and Approver

40 of 58

Review code example

40

41 of 58

Pull Request (PR) Example

41

42 of 58

Git Conflict

42

43 of 58

After Merge Conflict

43

Source: BH!J33T

44 of 58

Workflow with Git

44

Trunk-based

GitFlow

https://www.toptal.com/software/trunk-based-development-git-flow

45 of 58

45

Trunk-based

Good for small projects

Reduce time consuming

Micromanagement

Development quickly

46 of 58

46

GitFlow

Professional / Open Source

Lots of multilevel developers

Need lots of Scrum exp

Development stable

47 of 58

GitKraken

47

48 of 58

CI/CD Git Development

48

Hola

49 of 58

GitOps

49

50 of 58

Continuous Integration (CI)

50

51 of 58

Continuous Delivery/Deployment (CD)

51

52 of 58

Tools

52

Let me handle this…

53 of 58

or other tools

Real-life Example: Android / App Development

54 of 58

or other tools

Real-life Example: Android / App Development

Event

55 of 58

or other tools

Real-life Example: Android / App Development

Automation Test

CI

Event

56 of 58

or other tools

Real-life Example: Android / App Development

Automation Test

CI

CD

Event

57 of 58

57

DEMO

I’ll demo

58 of 58

Practice repo & QnA

58

github.com/GDSC-HCMUS/GDSCxSAB-cs101-git