git tag <version_number>

Create a new tag with the specified version number

This command is used to create a new tag in a git repository. The tag is used to mark a specific point in the repository's history.

It is commonly used to mark release versions of software. Tags can be useful for referencing specific commits or for tracking the state of the repository at a certain point in time.

To create a tag, provide the desired version number as the <version_number> parameter. For example, git tag v1.0.0 creates a new tag with the version number 'v1.0.0'. The tag will be associated with the current commit.

There are other variations of this command that can be used with different flags or shorter/longer versions of the flags:

  • git tag -a <version_number> -m <message>: Creates an annotated tag with a version number and a message.
  • git tag -l '<pattern>': List tags matching the specified pattern.
  • git tag -d <tag_name>: Deletes a tag with the specified name.
  • git tag --contains <commit_hash>: Lists tags that contain the specified commit.

Sign in to enable bookmarking, reminders, progress-tracking and more...