Work tree is reset to the state of the last pushed branch

* This fixes a bug when there no HEAD ref in the bare remote repository