Get latest changes from master to branch
git checkout piash # gets you "on branch piash"
git fetch origin # gets you up to date with origin
git merge origin/master
Merge detached head to origin/master
git checkout master && git merge [ref of HEAD] # ref of HEAD = latest hash of detached head
Restore state to a given commit and erase all newer commits from the record permanently
$ git reset --hard 766f