From the course: Source Code Control in .NET with Git Using SourceTree

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

What a detached head is, and how to avoid detached heads

What a detached head is, and how to avoid detached heads

From the course: Source Code Control in .NET with Git Using SourceTree

Start my 1-month free trial

What a detached head is, and how to avoid detached heads

- [Instructor] Sometimes you want to go back to a previous commit, however, if you just double-click on a commit, like that, it asks you to confirm that you're changing your working copy and it warns you that doing so will make your working copy a detached head. Nobody wants a detached head. The essence of having a detached head is that you won't be on a branch anymore so we don't want to do that, that's a bad thing to do. And here we have our detached head, let's go back up to our last check in and double-click on that and now the head is no longer detached. However, what if I do want to go back there? The best way to do that is either to switch branches, I can switch to CalculatorExtended and that'll take me back and I can go down to Calculator and that'll take me way back to the original calculator, but if I don't want one of those branches, let's go back to master. Let's say I want to come back to here and check this out, but I don't want a detached head. What I can do is…

Contents