1
00:00:02,060 --> 00:00:05,020
So with the installation out of the way,

2
00:00:05,020 --> 00:00:07,060
we can now dive into Git.

3
00:00:07,060 --> 00:00:10,520
Before we do that though, one last theory slide,

4
00:00:10,520 --> 00:00:14,210
because I want to make sure that whilst working with Git

5
00:00:14,210 --> 00:00:15,980
and while it's getting started,

6
00:00:15,980 --> 00:00:19,280
that you are already aware of some of the core terms

7
00:00:19,280 --> 00:00:21,480
that you have to understand to, well,

8
00:00:21,480 --> 00:00:23,240
easily work with Git.

9
00:00:23,240 --> 00:00:25,430
For this, let's think about a project

10
00:00:25,430 --> 00:00:27,460
which is managed by Git.

11
00:00:27,460 --> 00:00:28,840
In a Git-managed project

12
00:00:28,840 --> 00:00:32,610
you have two separate areas, so to say.

13
00:00:32,610 --> 00:00:35,280
One area, and that's the very important one

14
00:00:35,280 --> 00:00:40,280
for you as developer, is the so-called working directory.

15
00:00:40,550 --> 00:00:44,160
Your working directory is the current project folder,

16
00:00:44,160 --> 00:00:47,040
meaning all the current folders and files

17
00:00:47,040 --> 00:00:48,910
you are actively working on.

18
00:00:48,910 --> 00:00:51,810
So basically, the code version you interact with

19
00:00:51,810 --> 00:00:55,370
at the moment, where you implement changes and so on.

20
00:00:55,370 --> 00:00:59,040
That's one side of a Git-managed project.

21
00:00:59,040 --> 00:01:01,610
Now the active tracking part,

22
00:01:01,610 --> 00:01:05,220
so this part where Git is able to save different

23
00:01:05,220 --> 00:01:08,080
code snapshots and to track these changes,

24
00:01:08,080 --> 00:01:10,633
doesn't take place in this working directory.

25
00:01:11,600 --> 00:01:15,370
This takes place in the so-called repository.

26
00:01:15,370 --> 00:01:19,640
This repository is a hidden folder, actually a hidden area,

27
00:01:19,640 --> 00:01:21,770
which you cannot actively see.

28
00:01:21,770 --> 00:01:23,270
But in this repositories,

29
00:01:23,270 --> 00:01:26,100
we have all tracked files and folders,

30
00:01:26,100 --> 00:01:30,890
meaning all files and folders Git manages for us.

31
00:01:30,890 --> 00:01:33,480
Now, and from a conceptual perspective,

32
00:01:33,480 --> 00:01:37,060
if you add a specific file to this repository,

33
00:01:37,060 --> 00:01:38,470
we'll see how this works soon,

34
00:01:38,470 --> 00:01:39,567
and therefore tell Git,

35
00:01:39,567 --> 00:01:42,990
"Hey, please track changes I made to this file",

36
00:01:42,990 --> 00:01:47,010
then Git doesn't save again and again copies of that file

37
00:01:47,010 --> 00:01:49,390
if you, well, create a new code version

38
00:01:49,390 --> 00:01:51,250
that you want to save.

39
00:01:51,250 --> 00:01:54,300
Git only stores the first version of this file,

40
00:01:54,300 --> 00:01:56,340
and then just tracks changes.

41
00:01:56,340 --> 00:01:59,330
So it compares the current state with the latest state,

42
00:01:59,330 --> 00:02:02,100
and then says, "Okay, this is what you've changed

43
00:02:02,100 --> 00:02:03,750
so I have to keep this in mind

44
00:02:03,750 --> 00:02:06,867
if you want to work on this latest code snapshot."

45
00:02:07,860 --> 00:02:10,580
All some things will explore throughout this module,

46
00:02:10,580 --> 00:02:13,850
nevertheless, the idea of how Git manages all the

47
00:02:13,850 --> 00:02:16,650
tracked files and folders in this repositories,

48
00:02:16,650 --> 00:02:19,380
is based on the concept of commits.

49
00:02:19,380 --> 00:02:23,620
A commit is a single code snapshot and branches.

50
00:02:23,620 --> 00:02:27,193
Branches are where commits are stored, so to say.

51
00:02:28,100 --> 00:02:30,560
For example, thinking about such a commit,

52
00:02:30,560 --> 00:02:33,090
let's say you are in your working directory,

53
00:02:33,090 --> 00:02:35,430
you've changed something on some files,

54
00:02:35,430 --> 00:02:38,060
you are working in your working directory,

55
00:02:38,060 --> 00:02:39,693
and you added an image.

56
00:02:41,270 --> 00:02:44,650
Then you would also add such a commit message.

57
00:02:44,650 --> 00:02:48,730
So a message attached to this latest snapshot of the code

58
00:02:48,730 --> 00:02:52,320
you want to save and call it, well, "added image".

59
00:02:52,320 --> 00:02:55,540
With that, you and other developers are aware

60
00:02:55,540 --> 00:02:59,570
of what you changed in this snapshot that you want to save.

61
00:02:59,570 --> 00:03:01,390
Another code snapshot you want to save

62
00:03:01,390 --> 00:03:03,850
could be something like "fixed order button" here,

63
00:03:03,850 --> 00:03:07,340
for example. So basically whenever you change something,

64
00:03:07,340 --> 00:03:10,230
whenever you fix the bug, whenever you added a new feature,

65
00:03:10,230 --> 00:03:11,860
you create a new commit,

66
00:03:11,860 --> 00:03:16,140
a new code snapshot with such a commit message.

67
00:03:16,140 --> 00:03:18,260
And these commits are not somewhere saved

68
00:03:18,260 --> 00:03:20,020
in this repository.

69
00:03:20,020 --> 00:03:23,410
Each of these commits represents a single-code snapshots

70
00:03:23,410 --> 00:03:25,830
you can jump back to if you want to.

71
00:03:25,830 --> 00:03:29,090
And these snapshots are typically stored in the so-called

72
00:03:29,090 --> 00:03:31,960
main or master branch.

73
00:03:31,960 --> 00:03:35,290
That's so to say the core location,

74
00:03:35,290 --> 00:03:39,030
the core area where your main project is saved.

75
00:03:39,030 --> 00:03:40,640
So if you're working on a website

76
00:03:40,640 --> 00:03:44,090
and you have the latest state of your deployed website,

77
00:03:44,090 --> 00:03:46,690
then this would be the latest commit,

78
00:03:46,690 --> 00:03:51,090
the latest snapshot in the so-called master branch.

79
00:03:51,090 --> 00:03:54,470
Assuming that you want to improve things

80
00:03:54,470 --> 00:03:56,670
on this master branch though,

81
00:03:56,670 --> 00:03:59,160
for example adding such an order button,

82
00:03:59,160 --> 00:04:01,220
then you could create a new branch,

83
00:04:01,220 --> 00:04:03,400
for example feature branch,

84
00:04:03,400 --> 00:04:06,950
which then holds this updated code snapshot.

85
00:04:06,950 --> 00:04:09,070
And once this feature is finally finished

86
00:04:09,070 --> 00:04:11,210
and checked for box and so on,

87
00:04:11,210 --> 00:04:13,260
then you could bring this feature

88
00:04:13,260 --> 00:04:16,560
also back to this master branch.

89
00:04:16,560 --> 00:04:18,980
That's a bit more advanced at this stage though,

90
00:04:18,980 --> 00:04:22,840
but this is how Git works in a nutshell with the core terms.

91
00:04:22,840 --> 00:04:27,173
So working directory, repository, commits, and branches.

92
00:04:28,370 --> 00:04:30,380
With the theory out of the way though,

93
00:04:30,380 --> 00:04:32,763
let's now finally dive into Git.

