As matt and Bauhaus already noted in comments, a tag is just a name for an SHA-1.
But in fact, so is a branch!
When you do:
git checkout <sha-1>
git takes you "off" a branch and to a particular commit. Git calls this a "detached HEAD".
If you name a commit SHA-1 by some other method, such as a tag or a "remote branch" (
origin/master and the like), git does the same thing.
When you do:
git checkout branch_name
there is only one difference, but it's a very important one: git still checks out the SHA-1, just as with any other method, but it also puts you "on" the branch.
What this really means is that git writes the name of the branch into a file.1 That's what "being on a branch" means: that there's a file containing the name of the branch you are on.
Being "on a branch" mainly affects new commits. Any new commit you make, git writes the commit into the repository, along with the commit-message, author, timestamp, parent commits, and so on. Then, if you are "on a branch", git writes the new commit-ID into a file that keeps track of the tip of that branch.2 That causes the branch itself to point to the new commit. Let's say, just for example, that the new commit has SHA-1 ID
c0ffee.... Git writes
c0ffee... into the branch file.
Suppose you then
git checkout master and get "on branch master". Git switches to some other commit, on branch
master. Later, you want to come back and work more on branch
branch_name, so you
git checkout branch_name again. Git does the same thing every time: it sees that this is a branch name, looks up the SHA-1 for
branch_name, checks out commit
c0ffee..., and then—because it's a branch name—updates the "which branch am I on" file.
If you now make another new commit, git writes the commit as usual, and writes the ID—let's say it happens to be SHA-1
feedcab...—into the branch file as usual. So you're still "on branch
branch_name", but now that means "commit
The key difference here between a tag and a branch is that a tag is not expected to move, and git won't update it with new SHA-1 IDs; but a branch is expected to move, and git will update it automatically.
1The file is
.git/HEAD and after this it contains the string
.git/refs/heads/branch_name in this case. However, git also has "packed" refs which are stored in other files.