Timeline for Why did my Git repo enter a detached HEAD state?
Current License: CC BY-SA 3.0
29 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 8, 2022 at 3:48 | answer | added | Adam | timeline score: -1 | |
Sep 14, 2022 at 17:04 | answer | added | Raphael Setin | timeline score: 1 | |
Sep 30, 2021 at 7:37 | answer | added | Alexis Määttä Vinkler | timeline score: 4 | |
May 31, 2021 at 19:59 | answer | added | Francisco C | timeline score: 1 | |
Mar 28, 2021 at 9:49 | answer | added | Naser Nikzad | timeline score: 0 | |
Mar 11, 2021 at 3:32 | comment | added | BrainSlugs83 |
tl;dr -- you probably checked out a remote branch instead of the local one -- (or it doesn't exist) -- use this command to create the local branch and switch it: git switch -c <branch> --track <remote>/<branch>
|
|
Jan 26, 2021 at 18:21 | comment | added | René Nyffenegger | I often run into a detached HEAD state when I work with submodules. Unfortunately, I cannot reproduce such a state nor do I remember the exact sequence of commands that lead to the detached state. If someone had a hint on that, I'd be very grateful. | |
Jan 22, 2021 at 14:51 | answer | added | mfaani | timeline score: 8 | |
Mar 20, 2020 at 15:36 | comment | added | Adam Libuša |
@karunakarbhogyari The difference between git checkout my-branch and git checkout origin/my-branch is explained here: stackoverflow.com/a/30578803/1180977. As for the first case, remotes/origin/my-branch , I'd find it reasonable for git to behave similarly for all its commands. git show handles such branch names fine. I'd go as far as call it a bug, or at least an inconsistency in git-cli.
|
|
Mar 17, 2020 at 7:32 | comment | added | karunakar bhogyari | @adam Libusa,Thanks it worked for me. What is the difference between git checkout remotes/origin/my-branch and git checkout my-branch. Is it not the same. but what you said worked for me. Out of curiosity I am asking. | |
Nov 25, 2019 at 22:09 | answer | added | Tim Skov Jacobsen | timeline score: 13 | |
Nov 20, 2019 at 12:54 | comment | added | Adam Libuša |
Also happens if you accidentally type git checkout remotes/origin/my-branch instead of git checkout my-branch or git checkout origin/my-branch .
|
|
May 7, 2018 at 12:40 | answer | added | Nesha Zoric | timeline score: 2 | |
Sep 28, 2017 at 13:57 | answer | added | radzimir | timeline score: 11 | |
Jun 8, 2017 at 12:45 | answer | added | Thomas Weller | timeline score: 4 | |
May 23, 2017 at 11:47 | history | edited | URL Rewriter Bot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
May 27, 2016 at 21:41 | answer | added | dspeyer | timeline score: 4 | |
Sep 21, 2015 at 23:04 | history | edited | reevesy | CC BY-SA 3.0 |
deleted 23 characters in body
|
May 4, 2015 at 14:58 | answer | added | André R. | timeline score: 11 | |
Apr 23, 2015 at 15:43 | answer | added | Owen | timeline score: 182 | |
Jul 19, 2014 at 5:23 | history | edited | tckmn | CC BY-SA 3.0 |
deleted 75 characters in body
|
May 30, 2014 at 5:15 | comment | added | user456814 | For undoing a detached HEAD state, see Fix a Git detached head?. | |
May 30, 2014 at 5:10 | history | edited | user456814 | CC BY-SA 3.0 |
Clarified title, added list formatting to question link, removed bold formatting (the list formatting already helps to highlight the question).
|
Sep 22, 2011 at 1:57 | vote | accept | Adam Bergmark | ||
Oct 19, 2010 at 13:25 | comment | added | Cascabel |
Checking out a remote branch seems like the most common way to accidentally do this; another common way is to check out branch-name@{n} , the nth previous position of branch-name . But no matter what, at some point there must've been a git checkout <rev> . If that doesn't ring a bell, then probably you did what Will mentioned - tried to do git checkout <file> and managed to specify a revision by accident.
|
|
Oct 19, 2010 at 6:20 | history | edited | VonC | CC BY-SA 2.5 |
format question
|
Oct 19, 2010 at 6:08 | answer | added | Will | timeline score: 6 | |
Oct 19, 2010 at 6:04 | answer | added | VonC | timeline score: 409 | |
Oct 19, 2010 at 5:54 | history | asked | Adam Bergmark | CC BY-SA 2.5 |