From the course: Git from Scratch
Unlock this course with a free trial
Join today to access over 25,600 courses taught by industry experts.
DETACHED HEAD: An explanation - Git Tutorial
From the course: Git from Scratch
DETACHED HEAD: An explanation
- [Instructor] If you do this, check out a commit in the middle of a branch. You create a bit of a timeline crisis. You're actively trying to alter history and git does not want you to do that because just like in science fiction, if you changed the past, you could change the future which in our case means breaking the coherency of the version control branch. To prevent you from accidentally breaking time and altering history, when you check out a previous commit on any branch, you get this warning - 'Detached Head', which sounds rather ominous. I want to say this is just an example of programmers being a bit too dramatic but the warning detached head actually makes sense because it's an accurate description of what's happening. Git literally detaches head from the branch and puts it to the side. So now you're working out of time in a liminal space not attached to any timeline, which again sounds rather ominous, but is…
Contents
-
-
-
-
(Locked)
git branch: Create an alternate timeline1m 8s
-
(Locked)
HEAD: An introduction45s
-
(Locked)
git switch: Go to an alternate timeline40s
-
(Locked)
git checkout: Go to an alternate timeline58s
-
(Locked)
DETACHED HEAD: An explanation1m 15s
-
(Locked)
The difference between switch and checkout1m 40s
-
(Locked)
-