Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell if your head is detached in git?

How do you tell if your head has been detached in git? I have a feeling that might be the root of my problem.

like image 607
higgs241 Avatar asked Jun 26 '13 14:06

higgs241


1 Answers

An alternative useful for scripts, without having to deal with $GITDIR is

git rev-parse --abbrev-ref --symbolic-full-name HEAD

This gives me HEAD for a detached head, or the branch name on the other case.

like image 51
memoselyk Avatar answered Sep 28 '22 09:09

memoselyk