From the course: Git from Scratch

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

HEAD: An introduction

HEAD: An introduction - Git Tutorial

From the course: Git from Scratch

HEAD: An introduction

- [Instructor] Now we come to an important question. How does Git know where in this historical tree of time I am, and how do I know where I am? The answer is you are always working at the top of the current active branch where the head pointer is pointing. The name head literally means head of branch. If you're working in a new repository with a single main branch and you're just adding new commits, head will always point at the latest commit on the main branch. So that's where you are. If, on the other hands, you're working in a repository with several branches, so several alternate timelines, head will point at the latest commit of whatever branch you're currently working in. So in all seriousness, head is really your time machine. Point head at the timeline and moment in time you want to work in, and that's where you are.

Contents