I have a detached head in git. I am not interested to make any commit or save any changes, I just want to go to the head position of my branch. I have tried his command but it doesn't work:
git checkout MyBranch
Any help?
---- Update
when I trying to checkout, I am getting this message:
$ git checkout -f master
Switched to branch 'master'
Your branch is behind 'origin/master' by 6 commits, and can be fast-forwarded.
--- update 2 It says thetre are some changes, How can I remove them?
$ git merge origin/master
Updating fb5972a..28c2849
error: The following untracked working tree files would be overwritten by merge:
---
Please move or remove them before you can merge.
Aborting
How can I discard them?
These commands did not work:
$ git checkout -- .
$ git stash save --keep-index
No local changes to save
git checkout MyBranch
doesn't work," what do you mean? Does it fail, and if so, how?