课程: Git from Scratch
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
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.