git tag
- Git course
- Intermediate
- Lesson 21/82
- 4 min
Learn to mark release points with git tag.
What Are Git Tags?
A Git tag gives a name to a specific commit in the repository history. It is commonly used to mark release points such as v1.0.0.
git tag v1.0.0A tag makes the marked commit easier to identify. This helps you find which commit corresponds to a particular release.
Listing Tags and Marking a Specific Commit
You can run git tag without arguments to list the repository's tags. To tag a specific commit, add its commit ID at the end of the command.
git tag
git tag v1.0.0 a1b2c3dThe second command marks the a1b2c3d commit with the v1.0.0 tag.
Practice Print a Tag Command
Assign the git tag v2.0.0 command to the tagCommand variable and print it with console.log().
Starter code
const tagCommand = "";
// Komutu yazdırSample solution
const tagCommand = "git tag v2.0.0";
console.log(tagCommand);Expected output
git tag v2.0.0
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which command marks a release point with the name v1.0.0?
- git status v1.0.0
- git branch v1.0.0
- git tag v1.0.0 Correct answer
- git commit v1.0.0
Explanation: The git tag v1.0.0 command creates a tag named v1.0.0 on the current commit.
2 Create a Release Tag
git tag ____
git tag v2.1.0
Explanation: The tag name identifies the release. The git tag v2.1.0 command marks the current commit with that name.
3 Match Tag Concepts
| Term | Meaning |
|---|---|
git tag |
Command for creating a tag |
v1.0.0 |
Example of a release tag |
Commit |
The record marked by a tag |
Release |
A published version |