[{"data":1,"prerenderedAt":173},["ShallowReactive",2],{"term-d\u002Fdetached-head":3,"related-d\u002Fdetached-head":158},{"id":4,"title":5,"acronym":6,"body":7,"category":139,"description":140,"difficulty":141,"extension":142,"letter":143,"meta":144,"navigation":145,"path":146,"related":147,"seo":152,"sitemap":153,"stem":156,"subcategory":6,"__hash__":157},"terms\u002Fterms\u002Fd\u002Fdetached-head.md","Detached HEAD",null,{"type":8,"value":9,"toc":133},"minimark",[10,15,19,23,26,30,122,126,129],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 - The Vibe Check",[16,17,18],"p",{},"Detached HEAD is the state you end up in when you check out a specific commit instead of a branch, and git politely warns you that anything you commit here won't belong to any branch. It's like stepping off the trail to look at something interesting, totally fine to look around, but if you start building something there and then wander back to the trail, whatever you built gets left behind and can vanish.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"Detached HEAD occurs when HEAD points directly to a commit hash rather than to a branch reference, typically after checking out a specific commit, tag, or the result of a bisect. Any new commits made in this state are not attached to any branch and become unreachable, and thus eligible for garbage collection, the moment you check out a branch, unless you first create a new branch pointing at them with git switch -c or git branch.",[11,27,29],{"id":28},"show-me-the-code","Show Me The Code",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","$ git checkout a1b2c3d\nNote: switching to 'a1b2c3d'.\nYou are in 'detached HEAD' state...\n$ git switch -c rescue-branch\n","bash","",[38,39,40,59,84,106],"code",{"__ignoreMap":36},[41,42,45,49,53,56],"span",{"class":43,"line":44},"line",1,[41,46,48],{"class":47},"sBMFI","$",[41,50,52],{"class":51},"sfazB"," git",[41,54,55],{"class":51}," checkout",[41,57,58],{"class":51}," a1b2c3d\n",[41,60,62,65,68,71,75,78,81],{"class":43,"line":61},2,[41,63,64],{"class":47},"Note:",[41,66,67],{"class":51}," switching",[41,69,70],{"class":51}," to",[41,72,74],{"class":73},"sMK4o"," '",[41,76,77],{"class":51},"a1b2c3d",[41,79,80],{"class":73},"'",[41,82,83],{"class":51},".\n",[41,85,87,90,93,96,98,101,103],{"class":43,"line":86},3,[41,88,89],{"class":47},"You",[41,91,92],{"class":51}," are",[41,94,95],{"class":51}," in",[41,97,74],{"class":73},[41,99,100],{"class":51},"detached HEAD",[41,102,80],{"class":73},[41,104,105],{"class":51}," state...\n",[41,107,109,111,113,116,119],{"class":43,"line":108},4,[41,110,48],{"class":47},[41,112,52],{"class":51},[41,114,115],{"class":51}," switch",[41,117,118],{"class":51}," -c",[41,120,121],{"class":51}," rescue-branch\n",[11,123,125],{"id":124},"when-youll-hear-this","When You'll Hear This",[16,127,128],{},"\"You're in detached HEAD, make a branch before you commit anything else.\" \u002F \"I lost an afternoon of work because I forgot I was in detached HEAD.\"",[130,131,132],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":61,"depth":61,"links":134},[135,136,137,138],{"id":13,"depth":61,"text":14},{"id":21,"depth":61,"text":22},{"id":28,"depth":61,"text":29},{"id":124,"depth":61,"text":125},"git","Detached HEAD is the state you end up in when you check out a specific commit instead of a branch, and git politely warns you that anything you commit here...","beginner","md","d",{},true,"\u002Fterms\u002Fd\u002Fdetached-head",[148,149,150,151],"Reflog","Git Bisect","Reset","Branch",{"title":5,"description":140},{"changefreq":154,"priority":155},"weekly",0.7,"terms\u002Fd\u002Fdetached-head","7_DK6g-jXKCv0yeZdOSR49V8WBL_1C4EJ34RPRes5sE",[159,162,166,169],{"title":151,"path":160,"acronym":6,"category":139,"difficulty":141,"description":161},"\u002Fterms\u002Fb\u002Fbranch","A branch is like creating a parallel universe for your code.",{"title":149,"path":163,"acronym":6,"category":139,"difficulty":164,"description":165},"\u002Fterms\u002Fg\u002Fgit-bisect","intermediate","Git bisect is a binary search for bugs.",{"title":148,"path":167,"acronym":6,"category":139,"difficulty":164,"description":168},"\u002Fterms\u002Fr\u002Freflog","Git's reflog is the secret undo history that survives even after you think you've deleted something forever.",{"title":150,"path":170,"acronym":6,"category":139,"difficulty":171,"description":172},"\u002Fterms\u002Fr\u002Freset","advanced","Reset is like pressing undo on your commits.",1792528079089]