0

I did a checkout on the repo for my production site because I wanted to check a change. Now I pointed back my repo to the latest commit but now is not pointing to HEAD branch so instead of this

[gcardonav@gambit workshop]$ git status
# On branch master

I am getting this

[root@prod website]# git status
# Not currently on any branch.

I tried git reset --hard origin/HEAD but is still not pointing to branch master. What do I need to do?

aynber
  • 22,380
  • 8
  • 50
  • 63
Tavo
  • 173
  • 1
  • 15

1 Answers1

1

The HEAD pointer is detached, e.g. HEAD points at a commit that is not pointed by any of your branches. To get back to master you can run:

git checkout master

Now HEAD points at the commit that is pointed by master. Read this for more information

neshkeev
  • 6,280
  • 3
  • 26
  • 47
  • *You have `HEAD` is detached, e.g. `HEAD` points at a commit that is not pointed by any of your branches.* That's a bit imprecise. You're in detached-HEAD state when `HEAD` points at some commit *directly*, whether the latter is a branch's tip or not. See http://stackoverflow.com/questions/25670173/why-does-git-tell-me-not-currently-on-any-branch-after-i-run-git-checkout-ori/25670296#25670296 – jub0bs Aug 18 '15 at 17:00
  • Thank you, I didn't know how to express it more precisely. – neshkeev Aug 18 '15 at 17:01
  • Amend your answer accordingly and you'll get my upvote. – jub0bs Aug 19 '15 at 07:13