If the commit (that you need to return) is known and you want that to attach with the head of some branch then use:
git checkout <branch-name>
And also you can see the commits that your HEAD has previously pointed to by using:
For the latest versions of git, if you had done any checkouts something to moving your HEAD
You can also do:
git checkout -
This will take you back to the previous checkout. Thus, you can go back to the latest commits after checking out a previous commit.