‫In the last lecture we talked about the kids.
‫Check out this comment.
‫Also to unmodified the false and also it helps us to go back in time and check the state of the project
‫on any comet we want.
‫As I remember okay check checkout is just a read only command.
‫You are not able to undo things or create the new commits.
‫In previous states of the project now we are going to introduce you to other commands which allow us
‫to undo things and get the first commands that I am going to talk about is get revoked.
‫It is used to undo the changes to your project come in history.
‫So the reverse command takes the specified commit inverse the changes from the commit and creates a
‫new revert commit let's go ahead and see in practice how it actually works.
‫At first let's log the commit is to read using gate log dash dash one line so as you see overall we
‫have five commits.
‫Suppose that we want to undo the changes from the commit in which we added the paragraph in the estimate
‫document.
‫So how can we do that.
‫We should run the command get revert and then we have to specify the ideas of the commit.
‫So let's copy and paste it here.
‫Once we run this command event a new temporary file will be opened inside of our text editor.
‫You can see here revert with the message of the commit.
‫Actually we are able to change this message but for now I'm going to leave it as it is.
‫Then down below you will find that this reverts commit and we have an idea of the comet which will go
‫into reverse.
‫So now we have to close this file and once we do that then the paragraph will be deleted from the HMO
‫file and also as we already set a new committee will be made.
‫So if we run get log dash dash one line then you will find that the new comet is made revert.
‫Added paragraph so we have gone back in time and undid the specified Comet.
‫Actually between those two comets we have one comet created variable.
‫If we check this creep digest file you will find that the variable still exists.
‫It means that when you use get remote command you don't touch any of the changes which was made in another
‫comet.
‫You always undo the specified Comet.
‫So this picture is very useful because sometimes you may have some mistakes in your previous specified
‫comets and get a revert allows you to fix those mistakes without changing any other Comet.
‫All right let's move on and talk about get reset which actually is known as the dangerous and unsafe
‫command because it can permanently delete your work so you should be careful with get reset.
‫Let's go ahead and see actually how this comment works.
‫Before that I'm going to add a couple of comets to our project.
‫Let's create a simple navigation in each team of documents used not elements and then inside of it insert
‫least with a couple of list items
‫again.
‫If you're not familiar with those different elements and in general with HDMI L or C Ss or JavaScript
‫it's not really a problem.
‫You can feel free and use just the text files or even you can work with Office documents like Word Excel
‫and so on.
‫We just need to make some changes in your files.
‫All right let's go ahead and add the index the HDMI file to the staging area.
‫For that we need to get at and the finally then check the status so the file is ready to be committed.
‫Let's make a new commit with a message.
‫Added navigation
‫then let's go ahead and log the commit history
‫so here we have our last commit.
‫Now I'm going to make another one.
‫Let's go to this creep just file and create some simple function.
‫Then at this file to the staging area we need to get at script or J.
‫Yes and finally make the commit with the message created.
‫Function then log the history
‫so now suppose that we want to delete those two commits which we have just made.
‫So how can we do that.
‫That's the moment when Gates reset comes in.
‫We can run it reset and now we can use three different flags which actually act in different ways.
‫The first one is dash dash mixed which is a default flag.
‫It means that if we run just kids we said that the mixed flag will work anyway.
‫Besides that we have soft and heart I'm going to discuss all of those three flags.
‫Let's start with mixed.
‫So now we have to indicate the idea of the commit.
‫In this case when we want to delete those two commits we had to specify the idea of the previous commit.
‫I mean the idea of reverse added paragraph so if we run this comment and then check the history
‫you will see that the last two commits are removed but it doesn't mean that we removed physically the
‫navigation and the function from our files as you see both of them still exist.
‫So it means that we have just removed the comets from the history.
‫If we check status you will find that the index HDMI out and this creep J's files are onstage so they
‫no longer exist at the staging area.
‫So in order to discount the changes from the files I meant to remove them permanently.
‫We can't run get check out then dot now as you see we no longer have here the navigation and also the
‫function in the Java Sea file.
‫If we check the status then our working tree will be clean.
‫So that's the way how get reset.
‫Mixed works.
‫It just removes the committees from the history and also it onstage the files from the staging area.
‫They end up in the working directory.
‫Let's go ahead and describe other flags.
‫Let's say soft.
‫First of all log the history.
‫Now suppose that we want to remove the next two commits I mean reverse added paragraph and created variable
‫as we said.
‫Now we are going to use the flag soft.
‫So let's run get reset.
‫Dash dash soft and then we have to specify the I.D.
‫let's log the history again.
‫As the C commits are deleted but like the previous case files are not changed and the journalists who
‫file we still have the variable.
‫The difference between the soft and mixed flags is that in case of soft the files are maintained on
‫the staging area they are not upstaged.
‫If we check the status you will see that both files are green.
‫So it means that they are a staged now.
‫If we want to make the changes in the files we have to on stage both of them.
‫For that we have to use.
‫We set so in order to on stage both files will have to place here.
‫Dot and now if we check the status files we'll be on stage.
‫And finally in order to make the changes we have to use again gate checkout with dot as you see the
‫variable is deleted from the javascript fine.
‫Also as you can see the paragraph is displayed back which maybe is a slightly unexpected it happened
‫because we in fact deleted revert added paragraph.
‫Therefore the commit added paragraph is no longer under it.
‫Okay.
‫So that's the way how it gets reset soft works.
‫So both flags I mean mixed and soft remotely commits.
‫But the first one on stage the file from the staging area.
‫As for the second one it maintains them and doesn't onstage as is so in both cases we have gone through
‫a couple of steps in order to make the changes in files and not only remotely commits but if you want
‫to remove the command and also make the changes in files simultaneously you can simply use gets reset
‫with the hard flag.
‫Let's log the history again.
‫So now suppose that you want to delete all of the commits except the initial one and also at the same
‫time you want to make the changes in files as well.
‫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
‫changes are made in files.
‫The heading is removed.
‫Also this group the just file is deleted and we have the state of the project from the initial committee.
‫If we check the status you will see that the working theory is clean and also if we log the history
‫we will get just the single initial commit.
‫All right so that's the way how gets reversed and gets reset work.
‫I know that it might be a little bit hard to grasp.
‫So if you feel yourself confused if anything in this video is not clear then I recommend to re watch
‫this lecture and test things on your own.
‫Okay.
‫That's it.
‫See you in the next video.