0
0
Gitdevops~10 mins

Creating tags in Git - Visual Walkthrough

Choose your learning style9 modes available
Process Flow - Creating tags
Start: Have a commit
Choose tag name
Run git tag command
Tag created locally
Optional: Push tag to remote
Tag available for use
This flow shows how to create a tag on a commit locally and optionally push it to the remote repository.
Execution Sample
Git
git tag v1.0

git push origin v1.0
Creates a tag named 'v1.0' on the current commit and pushes it to the remote repository.
Process Table
StepCommandActionResult
1git tag v1.0Create tag 'v1.0' on current commitTag 'v1.0' created locally
2git tagList tagsShows 'v1.0' in tag list
3git push origin v1.0Push tag 'v1.0' to remoteTag 'v1.0' pushed to remote
4git ls-remote --tags originVerify remote tagsRemote shows 'refs/tags/v1.0'
5-EndTag 'v1.0' available locally and remotely
💡 Tag created locally and pushed to remote repository successfully
Status Tracker
VariableStartAfter Step 1After Step 3Final
tags[]["v1.0"]["v1.0"]["v1.0"] (local and remote)
Key Moments - 2 Insights
Why doesn't the tag appear on the remote after creating it locally?
Because creating a tag with 'git tag' only adds it locally. You must push it with 'git push origin <tag>' as shown in step 3 of the execution table.
Can I create a tag on a commit other than HEAD?
Yes, by specifying the commit hash after the tag name, e.g. 'git tag v1.0 <commit-hash>'. This is not shown here but works similarly.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the result after running 'git tag v1.0'?
ATag 'v1.0' created locally
BTag 'v1.0' pushed to remote
CTag list is empty
DRemote shows no tags
💡 Hint
Check Step 1 in the execution table for the immediate result of 'git tag v1.0'
At which step is the tag pushed to the remote repository?
AStep 1
BStep 3
CStep 2
DStep 4
💡 Hint
Look at the 'Command' column in the execution table to find when 'git push origin v1.0' is run
If you skip step 3, what will be the state of the tag on the remote?
ATag will be on remote
BTag will be deleted from remote
CTag will not be on remote
DRemote will have a different tag
💡 Hint
Refer to the variable_tracker and execution_table steps about pushing tags to remote
Concept Snapshot
Creating tags in git:
- Use 'git tag <name>' to create a tag locally on current commit.
- Use 'git tag <name> <commit>' to tag a specific commit.
- Tags are local until pushed with 'git push origin <name>'.
- Use 'git tag' to list local tags.
- Use 'git ls-remote --tags origin' to see remote tags.
Full Transcript
Creating tags in git involves choosing a tag name and running 'git tag <name>' to create it on the current commit locally. This tag does not appear on the remote repository until you push it using 'git push origin <name>'. You can verify local tags with 'git tag' and remote tags with 'git ls-remote --tags origin'. This process helps mark important points in your project history, like releases.