about summary refs log tree commit diff
path: root/usth/ICT2.7/P1L4 Version Control Subtitles/17 - GIT Recap: Local Repositories - lang_en_vs5.srt
blob: c29fae86b0fb980119abcb4e0fa0273ee1762f67 (plain) (blame)
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
1
00:00:00,100 --> 00:00:02,460
So, let me start by recapping some of the operations that

2
00:00:02,460 --> 00:00:06,000
we can perform on local repositories. I'm just going to list them

3
00:00:06,000 --> 00:00:09,240
here and go through them by separating them into three main

4
00:00:09,240 --> 00:00:12,930
categories. The first one is commands that, to create a repository and

5
00:00:12,930 --> 00:00:15,470
notice that not all of these are git commands, that for

6
00:00:15,470 --> 00:00:18,710
example, to create the repository, we would normally want to. Create a

7
00:00:18,710 --> 00:00:21,560
directory, which is exactly what we did in our demo. We want

8
00:00:21,560 --> 00:00:25,310
to go to that directory and then execute the git init statement,

9
00:00:25,310 --> 00:00:29,110
which initializes that directory as a git repository. The second

10
00:00:29,110 --> 00:00:32,530
category includes commands that we'll use to modify the content of

11
00:00:32,530 --> 00:00:35,280
the repository. We saw that we can use git add

12
00:00:35,280 --> 00:00:39,190
to add a specific file or a complete directory to our

13
00:00:39,190 --> 00:00:41,650
index. So to the list of files that will be

14
00:00:41,650 --> 00:00:44,510
committed, that will be considered in the next commit. Then we

15
00:00:44,510 --> 00:00:47,620
can use commit to actually commit the changes that we

16
00:00:47,620 --> 00:00:50,374
made to those files to our local repository, and we can

17
00:00:50,374 --> 00:00:54,030
also use git move and git rm or git remove

18
00:00:54,030 --> 00:00:57,420
to move files around and to remove files. Finally, the

19
00:00:57,420 --> 00:01:00,270
third category is the category of commands that we can

20
00:01:00,270 --> 00:01:04,950
use to inspect the concrete repository. And this set includes git

21
00:01:04,950 --> 00:01:06,960
log, that we can use to see the log of

22
00:01:06,960 --> 00:01:09,970
the repository, git status, that can give us important information

23
00:01:09,970 --> 00:01:12,810
about the status of the file center repository. Git diff,

24
00:01:12,810 --> 00:01:15,500
that we can use to see the differences between for example,

25
00:01:15,500 --> 00:01:19,160
our local files. And the remote files. And finally git

26
00:01:19,160 --> 00:01:23,270
show, that will show us information about our last commit. What

27
00:01:23,270 --> 00:01:25,940
we committed, what were the changes and so on. And again,

28
00:01:25,940 --> 00:01:29,290
we saw most or all of these commands in our demo.

29
00:01:29,290 --> 00:01:31,920
So let me also remind you of a possible workflow. Which

30
00:01:31,920 --> 00:01:34,350
again, we already saw but it's always good to go through

31
00:01:34,350 --> 00:01:37,670
it once more. And remember that this is just an example.

32
00:01:37,670 --> 00:01:40,520
It's just a possible workflow. You can do many different things,

33
00:01:40,520 --> 00:01:43,210
you can have many different workflows with git. This is just

34
00:01:43,210 --> 00:01:45,980
up to illustrate some of the things that you can do. So,

35
00:01:45,980 --> 00:01:49,430
you might do some local editing. Execute git status to see what

36
00:01:49,430 --> 00:01:53,020
files you changed. Then you might run a git diff on the

37
00:01:53,020 --> 00:01:56,230
files to see what are these changes. And then you can run

38
00:01:56,230 --> 00:01:59,460
git commit -a to commit your changes. And in case you

39
00:01:59,460 --> 00:02:02,520
want to specify the commit message right away without having to go

40
00:02:02,520 --> 00:02:06,040
through an editor, you can also add the -m parameter and

41
00:02:06,040 --> 00:02:08,110
specify the message here on the same line.