18 Tagging Milestones

You need to make milestones in your projects, each slightly different, such as for one, its weekly iterations, and for another, its version numbers. You can use git tag to handle this.

git tag creates a read-only marker within the repository. You can treat tags like branch names, except you can’t check them out and start committing to them. You can create a new branch from a tag, however.

Creating a tag requires one parameter: the name of the tag. Nearly every character you can use as part of a filename on Unix systems can be used as part of a tag name. You cannot use the characters ^, *, or :, and a tag cannot begin or end with /.

You can create a tag from a commit other than HEAD by supplying a second parameter to git tag. It can be a reference commit (either directly or relative to another commit) or a branch name (directly or relative as well).

Call git tag without any parameters to list all tags. One key difference between tags and branches is that there is no difference between a remote tag and a local tag. A tag is a tag.

What To Do...
  • List all tags.
     
    prompt>​ git tag
     
    v0.1
     
    v0.2
  • Tag the latest commit as version 1.0 in the current branch.
     
    prompt>​ git tag v1.0
     
    prompt>
  • Create a tag called beta1 from the next to last commit.
     
    prompt>​ git tag beta1 HEAD^
     
    prompt>

Related Tasks

Footnotes

[13]

Gitk is a cross-platform application written in tcl/tk that ships with Git.

[14]

A Mac-only clone of Gitk that is designed to be more “Mac-like.” It’s available from http://gitx.frim.nl/.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.188.121