Appendix A. Leftovers: The Top Five Topics We Didn’t Cover

Image

We’ve covered a lot of ground, and you’re almost finished with this book. We’ll miss you, but before we let you go, we wouldn’t feel right about sending you out into the world without a little more preparation. Git offers a lot of functionality, and we couldn’t possibly fit all of it in one book. We saved some really juicy bits for this appendix.

#1 Tags (remember me forever)

You know that Git branches are sticky notes—a branch is simply a named reference to a commit. You also know that if you make a new commit on a branch, Git moves the branch to point to the new commit ID on that branch. Tags, like branches, are also named references to commits, except that once they are created, they never move. Tags are very useful if you want to name a commit so you can find and get it to easily. We use tags to record “landmarks” in a project history. For example, we could tag the commit that marks a specific version of our software, like v1.0.0. Or the commit that fixed a particularly nasty bug. To create a tag, Git offers the git tag command:

Image

By default, the tag command will record the current ID (that is, where HEAD points to) in the tag. However, you can supply a specific commit ID after the tag name.

Tag names follow ...

Get Head First Git now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.