The HEAD pointer in Git points to the current branch reference, which in turn points to the latest commit checked out in your working directory. It helps Git know which commit you are currently on.
git symbolic-ref HEAD when you are on the branch named feature?The command git symbolic-ref HEAD outputs the full reference path of the current branch HEAD points to, which is refs/heads/feature if you are on the feature branch.
git checkout <commit-hash> directly, detaching the HEAD? Choose the correct description.When you checkout a commit hash directly, HEAD points to that commit instead of a branch. This is called a detached HEAD state, meaning you are not on any branch.
In detached HEAD state, commits are not part of any branch. If you switch branches or checkout another commit, these commits can become unreachable and lost unless you create a branch or tag to keep them.
Creating a new branch at the current commit saves your work by giving the commits a branch reference. This prevents them from being lost when switching branches.