If you are not afraid of losing any local history, you can switch to another branch and then delete the local branch and then check the remote version. For example, if you want to return a branch named "test_feature", you can do this:
$ git checkout master $ git branch -D test_feature
NOTE. -D will force the branch to be deleted and will suppress warnings about unrelated changes.
This is useful if you merged a branch that you did not intend, because the HEAD pointer may change depending on the type of merge.
EDIT . Another way to do the same: just type:
git reset
This will reset the branch that you are currently in to the state of the remote (in this case) branch of test_feature .
@hvgotcodes has a variant of this in his example (he aims to commit HEAD)
source share