README.md 2.39 KB
Newer Older
Fanch's avatar
Fanch committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
## 1. What and Why Git

#### Exercise:
- say what you think git is and where did you see/use it

#### Concept:
- version control
- share with team

## 2. Create repository

#### Exercise:
- Create on gitlab/github
- Create in a folder on your computer

#### Concept:
- Every git repository is independant

#### Command:
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
20
21
- `mkdir my_project`
- `git init`
Fanch's avatar
Fanch committed
22

Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
23
## 3. Create file in GUI
Fanch's avatar
Fanch committed
24
25

#### Exercice:
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
26
- create a file called `first_file.txt` in the GUI
Fanch's avatar
Fanch committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
- add content in this file, like "hello world"

#### Concept
- commit
- history

## 4. Link repository

#### Exercise:
- add a remote in you git folder on your computer

#### Concept:
- get content and modification

#### Command
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
42
43
- `git remote`
- `git pull`
Fanch's avatar
Fanch committed
44
45
46
47

## 5. Create file on your computer

#### Exercice:
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
48
- create a file called `second_file.txt` in `my_project folder`
Fanch's avatar
Fanch committed
49
50
51
52
53
54
55
- add content in this file, like "I love linux"

#### Concept:
- local modification
- commit message

#### Command:
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
56
57
58
- `git add`
- `git status`
- `git commit`
Fanch's avatar
Fanch committed
59
60
61
62
63
64
65
66
67
68

## 6. Report modification on Gitlab/Github

#### Exercise:
- Push your local modification on remote

#### Concept
- compare history

#### Command:
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
69
70
71
- `git push`
- `git status`
- `git log`
Fanch's avatar
Fanch committed
72
73
74
75
76
77

## 7. Pause 5 minutes

## 8. Create Branch

#### Exercise:
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
78
- create a local `branch my_first_branch`
Fanch's avatar
Fanch committed
79
80
81
82
83
84
85
86
- Modify a file
- Push the branch on github/gitlab

#### Concept:
- branch tree
- best practice (master/main as ref, branch for bugfix/feature)

#### Command:
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
87
88
89
- `git checkout`
- `git commit`
- `git push`
Fanch's avatar
Fanch committed
90
91
92
93

## 9. Create Merge Request

#### Exercise:
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
94
- in gitlab/github create a merge request for `my_first_branch`
Fanch's avatar
Fanch committed
95
96
97
98
99
100
101
102
- wait for comment on other person merge request
- get local modif after merge

#### Concept:
- code review
- merge

#### Command:
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
103
104
- `git fetch`
- `git merge`
Fanch's avatar
Fanch committed
105
106
107
108
109
110
111
112
113
114
115

## 10. Get existing repository

#### Exercise:
- Fork repository in gitlab/github
- Get a local copy

#### Concept:
- fork

#### Command:
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
116
117
- `git clone`
- `git remote`
Fanch's avatar
Fanch committed
118
119
120
121
122

## 11. Propose change

#### Exercise:
- Create a Local Branch
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
123
- Add a file `your_firstname.txt` with content like "I love git"
Fanch's avatar
Fanch committed
124
125
126
127
128
129
130
- Push on your forked repository
- Create a Merge Request

#### Concept:
- share work

#### Comand:
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
131
132
133
134
- `git checkout`
- `git add`
- `git commit`
- `git push`
Fanch's avatar
Fanch committed
135
136
137
138
139
140
141
142
143
144

## 12. Update your fork

#### Exercise:
- Update your forked repositiory

#### Concept:
- keep master/main clean

#### Command:
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
145
146
- `git pull`
- `git push`
Fanch's avatar
Fanch committed
147
148
149
150
151
152
153
154

## 13. Pause 5 minutes

## 14. Bonus if enought time

## Concept:
- work branch
- rebase/reset