Learning about version control has been a real eye opener. I now wonder how I could have thought I was effectively tracking code versions before now.
Version Control is a means of effectively tracking changes in documentation, source code, files, etc for any project.
Git is one of the popular tools used to implement version control. changes to the project are called commits which is addressable via a hash calculated based on several factors such as the content of the files, content of the directory, committer, amongst others. This means that git would notice any file manipulation as the corresponding hash would no longer fit the content.
One way Git helps users navigate through changes is by making use of HEAD. HEAD tells Git your current position as you navigate through commits and branches. In more official lingo, HEAD symbolic reference to the branch that is currently checked out.
When the HEAD points directly to a commit, it becomes known as a detached HEAD. This occurs when you checkout a specific commit instead of a branch. You can recover detached HEAD by checking it out to a new branch. If you move to another branch before attaching the detached HEAD to a branch, you would need to make use of the ‘git reflog’ command which is basically a log of the HEAD activities. the command would help you figure out the hash value of the detached HEAD and check it out to a new branch.