[git] What are the git concepts of HEAD, master, origin?

As I'm learning about git, I keep coming across the terms HEAD, master, origin, and I'm not sure what the differences are. If I understand correctly, HEAD is always equal to the latest revision? And if so, is that the latest revision of the whole repository, or of a specific branch or tag? This is so confusing. I've read so many tutorials on this and things like branching/merging, but still can't wrap my head around it.

This question is related to git

The answer is


While this doesn't directly answer the question, there is great book available for free which will help you learn the basics called ProGit. If you would prefer the dead-wood version to a collection of bits you can purchase it from Amazon.


HEAD is not the latest revision, it's the current revision. Usually, it's the latest revision of the current branch, but it doesn't have to be.

master is a name commonly given to the main branch, but it could be called anything else (or there could be no main branch).

origin is a name commonly given to the main remote. remote is another repository that you can pull from and push to. Usually it's on some server, like github.