Instructor: Let's look at our local git log with git log one line. Let's go all the way back to where we added the index.html and app.js files.
If we want to explore what the code looked like at that time, we can gitCheckout this hash. Now, it says we're in a detached head state. If we go look at our app.js code, this is when we first edited, just had the comment at the top.
What a detached head means if we do a git log one line, we can see that our head is not pointing to a branch right now. Instead, it's pointing to a commit. This is problematic because if we make changes right now, and then move our head away, then those changes could be lost.
We could just poke around and then switch to a branch, and that would be fine. If we want to make changes here, then what we have to do is do what it says right here, which is to check out a new branch at this hash. We're going to gitCheckout a new branch, and we'll just call this exploring a JS feature.
If we do get status, we're no longer in a detached head state. If we do git log online, we can see that our head is now successfully pointing to a branch. Now, any changes we make here won't get lost. If you do get branch -vv now, you can see our new branch here, which is not a remote branch, and it's different than the other two branches, which are remote branches.