We learn in this lesson that
git reset HEAD filename is a useful way to unstage
filename and update the
HEAD pointer. Is there a way to simply update the
HEAD pointer while keeping the stage as is?
The short answer is yes but let’s first justify wanting to move the
HEAD and leave the staging area the same. One reason you may want to rollback the
HEAD without clearing the staging area is to commit the files currently in the staging area immediately (or soon) after the rollback.
With that in mind, how do we do this? The way we accomplish this is by writing
git reset --soft HEAD
or if you have the commit SHA hash,
git reset --soft commitSHA
So the key is to use
reset with the argument