How to make Head point to master in git?

Please help to make Head point to master in git

git问题图片

I tried to

git rebase HEAD master

and

git checkout master

Nothing of those helps.

Updated: Strange I tried:

git symbolic-ref HEAD
refs/heads/master

then

git rev-parse refs/heads/master
fc550e5ff2fe49d64ee1d8bf0da09b2b24bf2cd7

and then I got strange warning after the following command

git rev-parse HEAD
warning: refname 'HEAD' is ambiguous.
fc550e5ff2fe49d64ee1d8bf0da09b2b24bf2cd7

New Update: There was HEAD branch in remotes -> origin . After removing it everything is ok. I do not have that warning anymore.


IF you don't have any local work in progress:

git checkout master
git reset --hard     # reset HEAD to the master branch

But, if ' HEAD ' is also the name of a branch:

  • Don't do that. HEAD shouldn't be the name of a branch: rename it.
  • You can try a:

    git checkout master
    git merge HEAD
    
  • Which should fast-forward that branch to master .


    Actually, the OP confirms:

    There was HEAD branch in remotes/origin.
    After removing it everything is ok. I do not have that warning anymore.

    Note this is different from origin/HEAD , which identifies the default branch on that remote repository.

    链接地址: http://www.djcxy.com/p/2620.html

    上一篇: git分支重命名是否会影响分支层次结构?

    下一篇: 如何使头在git中掌握?