﻿1
00:00:02,180 --> 00:00:04,190
‫In the last lecture we talked about the kids.

2
00:00:04,190 --> 00:00:05,630
‫Check out this comment.

3
00:00:05,700 --> 00:00:12,020
‫Also to unmodified the false and also it helps us to go back in time and check the state of the project

4
00:00:12,050 --> 00:00:13,460
‫on any comet we want.

5
00:00:14,230 --> 00:00:17,960
‫As I remember okay check checkout is just a read only command.

6
00:00:18,020 --> 00:00:21,230
‫You are not able to undo things or create the new commits.

7
00:00:21,230 --> 00:00:27,140
‫In previous states of the project now we are going to introduce you to other commands which allow us

8
00:00:27,140 --> 00:00:32,730
‫to undo things and get the first commands that I am going to talk about is get revoked.

9
00:00:32,750 --> 00:00:36,790
‫It is used to undo the changes to your project come in history.

10
00:00:37,040 --> 00:00:43,520
‫So the reverse command takes the specified commit inverse the changes from the commit and creates a

11
00:00:43,520 --> 00:00:48,830
‫new revert commit let's go ahead and see in practice how it actually works.

12
00:00:49,010 --> 00:00:57,100
‫At first let's log the commit is to read using gate log dash dash one line so as you see overall we

13
00:00:57,100 --> 00:00:58,740
‫have five commits.

14
00:00:58,840 --> 00:01:04,570
‫Suppose that we want to undo the changes from the commit in which we added the paragraph in the estimate

15
00:01:04,570 --> 00:01:05,070
‫document.

16
00:01:05,590 --> 00:01:07,290
‫So how can we do that.

17
00:01:07,450 --> 00:01:14,850
‫We should run the command get revert and then we have to specify the ideas of the commit.

18
00:01:14,900 --> 00:01:16,720
‫So let's copy and paste it here.

19
00:01:18,800 --> 00:01:25,820
‫Once we run this command event a new temporary file will be opened inside of our text editor.

20
00:01:25,940 --> 00:01:29,250
‫You can see here revert with the message of the commit.

21
00:01:29,360 --> 00:01:34,700
‫Actually we are able to change this message but for now I'm going to leave it as it is.

22
00:01:34,700 --> 00:01:41,060
‫Then down below you will find that this reverts commit and we have an idea of the comet which will go

23
00:01:41,060 --> 00:01:42,410
‫into reverse.

24
00:01:42,410 --> 00:01:49,300
‫So now we have to close this file and once we do that then the paragraph will be deleted from the HMO

25
00:01:49,310 --> 00:01:53,700
‫file and also as we already set a new committee will be made.

26
00:01:53,720 --> 00:02:02,730
‫So if we run get log dash dash one line then you will find that the new comet is made revert.

27
00:02:02,810 --> 00:02:10,780
‫Added paragraph so we have gone back in time and undid the specified Comet.

28
00:02:10,780 --> 00:02:15,730
‫Actually between those two comets we have one comet created variable.

29
00:02:15,970 --> 00:02:21,520
‫If we check this creep digest file you will find that the variable still exists.

30
00:02:21,520 --> 00:02:28,330
‫It means that when you use get remote command you don't touch any of the changes which was made in another

31
00:02:28,330 --> 00:02:29,170
‫comet.

32
00:02:29,170 --> 00:02:31,450
‫You always undo the specified Comet.

33
00:02:32,320 --> 00:02:37,960
‫So this picture is very useful because sometimes you may have some mistakes in your previous specified

34
00:02:37,960 --> 00:02:45,220
‫comets and get a revert allows you to fix those mistakes without changing any other Comet.

35
00:02:45,220 --> 00:02:51,940
‫All right let's move on and talk about get reset which actually is known as the dangerous and unsafe

36
00:02:51,940 --> 00:02:58,460
‫command because it can permanently delete your work so you should be careful with get reset.

37
00:02:58,480 --> 00:03:01,630
‫Let's go ahead and see actually how this comment works.

38
00:03:01,630 --> 00:03:04,800
‫Before that I'm going to add a couple of comets to our project.

39
00:03:05,440 --> 00:03:14,680
‫Let's create a simple navigation in each team of documents used not elements and then inside of it insert

40
00:03:15,090 --> 00:03:18,850
‫least with a couple of list items

41
00:03:23,940 --> 00:03:24,420
‫again.

42
00:03:25,080 --> 00:03:31,290
‫If you're not familiar with those different elements and in general with HDMI L or C Ss or JavaScript

43
00:03:31,710 --> 00:03:33,280
‫it's not really a problem.

44
00:03:33,360 --> 00:03:39,870
‫You can feel free and use just the text files or even you can work with Office documents like Word Excel

45
00:03:39,900 --> 00:03:40,860
‫and so on.

46
00:03:40,860 --> 00:03:43,620
‫We just need to make some changes in your files.

47
00:03:43,700 --> 00:03:48,480
‫All right let's go ahead and add the index the HDMI file to the staging area.

48
00:03:48,480 --> 00:03:59,920
‫For that we need to get at and the finally then check the status so the file is ready to be committed.

49
00:03:59,970 --> 00:04:03,890
‫Let's make a new commit with a message.

50
00:04:04,260 --> 00:04:05,460
‫Added navigation

51
00:04:09,450 --> 00:04:11,810
‫then let's go ahead and log the commit history

52
00:04:16,740 --> 00:04:19,700
‫so here we have our last commit.

53
00:04:19,730 --> 00:04:21,600
‫Now I'm going to make another one.

54
00:04:21,740 --> 00:04:25,990
‫Let's go to this creep just file and create some simple function.

55
00:04:29,780 --> 00:04:35,320
‫Then at this file to the staging area we need to get at script or J.

56
00:04:35,330 --> 00:04:43,310
‫Yes and finally make the commit with the message created.

57
00:04:43,340 --> 00:04:47,710
‫Function then log the history

58
00:04:51,600 --> 00:04:57,300
‫so now suppose that we want to delete those two commits which we have just made.

59
00:04:57,300 --> 00:04:59,060
‫So how can we do that.

60
00:04:59,070 --> 00:05:01,920
‫That's the moment when Gates reset comes in.

61
00:05:01,920 --> 00:05:11,240
‫We can run it reset and now we can use three different flags which actually act in different ways.

62
00:05:11,240 --> 00:05:17,150
‫The first one is dash dash mixed which is a default flag.

63
00:05:17,160 --> 00:05:22,060
‫It means that if we run just kids we said that the mixed flag will work anyway.

64
00:05:22,260 --> 00:05:31,530
‫Besides that we have soft and heart I'm going to discuss all of those three flags.

65
00:05:32,070 --> 00:05:34,950
‫Let's start with mixed.

66
00:05:34,980 --> 00:05:38,110
‫So now we have to indicate the idea of the commit.

67
00:05:38,220 --> 00:05:43,790
‫In this case when we want to delete those two commits we had to specify the idea of the previous commit.

68
00:05:44,220 --> 00:05:52,140
‫I mean the idea of reverse added paragraph so if we run this comment and then check the history

69
00:05:55,410 --> 00:06:01,350
‫you will see that the last two commits are removed but it doesn't mean that we removed physically the

70
00:06:01,350 --> 00:06:06,510
‫navigation and the function from our files as you see both of them still exist.

71
00:06:06,510 --> 00:06:10,260
‫So it means that we have just removed the comets from the history.

72
00:06:10,650 --> 00:06:20,290
‫If we check status you will find that the index HDMI out and this creep J's files are onstage so they

73
00:06:20,350 --> 00:06:23,530
‫no longer exist at the staging area.

74
00:06:23,530 --> 00:06:28,280
‫So in order to discount the changes from the files I meant to remove them permanently.

75
00:06:28,390 --> 00:06:41,050
‫We can't run get check out then dot now as you see we no longer have here the navigation and also the

76
00:06:41,050 --> 00:06:43,410
‫function in the Java Sea file.

77
00:06:44,350 --> 00:06:50,140
‫If we check the status then our working tree will be clean.

78
00:06:51,520 --> 00:06:53,270
‫So that's the way how get reset.

79
00:06:53,290 --> 00:06:54,560
‫Mixed works.

80
00:06:54,760 --> 00:07:01,060
‫It just removes the committees from the history and also it onstage the files from the staging area.

81
00:07:01,240 --> 00:07:03,340
‫They end up in the working directory.

82
00:07:03,910 --> 00:07:05,980
‫Let's go ahead and describe other flags.

83
00:07:06,010 --> 00:07:08,450
‫Let's say soft.

84
00:07:08,530 --> 00:07:12,600
‫First of all log the history.

85
00:07:12,610 --> 00:07:18,790
‫Now suppose that we want to remove the next two commits I mean reverse added paragraph and created variable

86
00:07:19,330 --> 00:07:19,960
‫as we said.

87
00:07:19,990 --> 00:07:22,170
‫Now we are going to use the flag soft.

88
00:07:22,510 --> 00:07:24,790
‫So let's run get reset.

89
00:07:24,910 --> 00:07:29,570
‫Dash dash soft and then we have to specify the I.D.

90
00:07:33,460 --> 00:07:35,690
‫let's log the history again.

91
00:07:37,700 --> 00:07:44,780
‫As the C commits are deleted but like the previous case files are not changed and the journalists who

92
00:07:44,780 --> 00:07:46,830
‫file we still have the variable.

93
00:07:46,880 --> 00:07:52,250
‫The difference between the soft and mixed flags is that in case of soft the files are maintained on

94
00:07:52,250 --> 00:07:55,130
‫the staging area they are not upstaged.

95
00:07:55,460 --> 00:08:00,430
‫If we check the status you will see that both files are green.

96
00:08:00,550 --> 00:08:04,300
‫So it means that they are a staged now.

97
00:08:04,330 --> 00:08:08,950
‫If we want to make the changes in the files we have to on stage both of them.

98
00:08:09,010 --> 00:08:10,470
‫For that we have to use.

99
00:08:10,480 --> 00:08:15,850
‫We set so in order to on stage both files will have to place here.

100
00:08:15,890 --> 00:08:22,830
‫Dot and now if we check the status files we'll be on stage.

101
00:08:22,860 --> 00:08:31,860
‫And finally in order to make the changes we have to use again gate checkout with dot as you see the

102
00:08:31,860 --> 00:08:34,870
‫variable is deleted from the javascript fine.

103
00:08:35,130 --> 00:08:41,880
‫Also as you can see the paragraph is displayed back which maybe is a slightly unexpected it happened

104
00:08:41,910 --> 00:08:46,020
‫because we in fact deleted revert added paragraph.

105
00:08:46,140 --> 00:08:50,510
‫Therefore the commit added paragraph is no longer under it.

106
00:08:50,550 --> 00:08:50,850
‫Okay.

107
00:08:50,910 --> 00:08:53,850
‫So that's the way how it gets reset soft works.

108
00:08:53,850 --> 00:08:57,440
‫So both flags I mean mixed and soft remotely commits.

109
00:08:57,600 --> 00:09:01,440
‫But the first one on stage the file from the staging area.

110
00:09:01,440 --> 00:09:07,830
‫As for the second one it maintains them and doesn't onstage as is so in both cases we have gone through

111
00:09:07,860 --> 00:09:13,860
‫a couple of steps in order to make the changes in files and not only remotely commits but if you want

112
00:09:13,860 --> 00:09:19,620
‫to remove the command and also make the changes in files simultaneously you can simply use gets reset

113
00:09:19,650 --> 00:09:20,610
‫with the hard flag.

114
00:09:21,270 --> 00:09:22,720
‫Let's log the history again.

115
00:09:24,670 --> 00:09:30,420
‫So now suppose that you want to delete all of the commits except the initial one and also at the same

116
00:09:30,420 --> 00:09:33,070
‫time you want to make the changes in files as well.

117
00:09:33,090 --> 00:09:44,430
‫For that we have to run get reset dash dash hard and then we have to specify the I.D. so as to say the

118
00:09:44,430 --> 00:09:45,780
‫changes are made in files.

119
00:09:45,780 --> 00:09:47,310
‫The heading is removed.

120
00:09:47,310 --> 00:09:53,830
‫Also this group the just file is deleted and we have the state of the project from the initial committee.

121
00:09:53,880 --> 00:10:00,960
‫If we check the status you will see that the working theory is clean and also if we log the history

122
00:10:01,590 --> 00:10:05,150
‫we will get just the single initial commit.

123
00:10:05,250 --> 00:10:09,350
‫All right so that's the way how gets reversed and gets reset work.

124
00:10:09,360 --> 00:10:12,070
‫I know that it might be a little bit hard to grasp.

125
00:10:12,360 --> 00:10:18,270
‫So if you feel yourself confused if anything in this video is not clear then I recommend to re watch

126
00:10:18,270 --> 00:10:20,710
‫this lecture and test things on your own.

127
00:10:21,400 --> 00:10:21,770
‫Okay.

128
00:10:22,050 --> 00:10:22,500
‫That's it.

129
00:10:22,500 --> 00:10:23,580
‫See you in the next video.


