This is up in GitHub, so we can check it out there, as well. Let's push this up to GitHub before we make any more mistakes. We used reset -hard both to get rid of this commit by resetting to this commit, but also to recover it again from the ref log. ![]() If we do a git log oneline, we can see that we have our regular commits, and then we have the take three commit back on as master. We want to reset master to this commit to recover it so we can take the hash and we can git reset -hard back to that hash. Rough log will work to save commits but only if they haven't been garbage collected by Git yet. Now, we want to recover this commit here, this take three commit, but one thing to note is that this commit, because we reset hard, is now abandoned and will actually get garbage collected eventually if we don't save it. For example, you can see the three latest resets that we've done and this last one was the reset hard. For that, we're going to use git rough log which is a really powerful way to look at all the different things you've done in your local Git repository. We really want to get that function back so let's take a look at how we might do that. Back to the past.Instructor: We just did a git reset -hard back one which removed our function from app.js. They are just playing hide and sneak because you told them to. git folder and start over.â Your changes arenât âgoneâ. ![]() This is why people say âdonât delete your. These HEAD and masters pointers are just that⦠pointers. Notice how HEAD and master pointers just move back to that commit ID. The must be one of the following: -soft Does not touch the index file or the working tree at all (but resets the head to , just like all modes do). If is omitted, defaults to -mixed.We just told git to hide them from ourselves, but not from git. Before the operation, ORIGHEAD is set to the tip of the current branch. Notice how the commits for files 4, 5, and 6 are there, but just dotted out (or whatever the official term is). Letâs learn some magic tricks using the git visualization tool at Īlrighty. How on earth is this possible?! I give up. In fact, if we do a `git log` weâre back to where we were at. This- git restore patch-command is used to restore modified changes. ![]() The lightbulb moment for me was that git was keeping those commits around, and not to mention git is also keeping an actual log of everything going on alongside my repoâs git log. The command`git reflog` will show you the actual history of your git commands AND THEIR COMMIT IDS!! Will the real Git Log please stand up? please stand up. In addition,`ls` and `git ls-files` shows how files 5 and 6 are âgoneâ! Notice how the above image confirms the git log only shows the commits up to file 4. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |