Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is semantic versioning in Git tags?
Semantic versioning is a way to name Git tags using a format like MAJOR.MINOR.PATCH. It helps track changes clearly: MAJOR for big changes, MINOR for new features, PATCH for fixes.
Click to reveal answer
beginner
What does the tag v2.1.0 tell you about the project?
The tag v2.1.0 means the project is on major version 2, minor version 1, and patch 0. It shows new features were added since version 2.0.0, but no bug fixes yet.
Click to reveal answer
beginner
How do you create a lightweight Git tag named v1.0.0?
Use the command: git tag v1.0.0. This creates a simple tag pointing to the current commit.
Click to reveal answer
intermediate
How do annotated tags differ from lightweight tags in Git?
Annotated tags store extra info like tagger name, date, and message. Lightweight tags are just simple pointers to commits without extra data.
Click to reveal answer
beginner
What command lists all tags in a Git repository?
Use git tag to list all tags. You can see all semantic version tags this way.
Click to reveal answer
What does the PATCH number in semantic versioning represent?
ABug fixes and small improvements
BNew features added
CBig changes that break compatibility
DChanges to documentation only
✗ Incorrect
PATCH is for bug fixes and small improvements that do not change features or break compatibility.
Which command creates an annotated tag named v1.2.3?
Agit tag v1.2.3
Bgit create tag v1.2.3
Cgit tag -a v1.2.3 -m "Release 1.2.3"
Dgit tag --list v1.2.3
✗ Incorrect
The -a option creates an annotated tag with a message.
What does the tag v3.0.0 usually indicate?
APatch update
BMajor update with possible breaking changes
CMinor feature update
DPre-release version
✗ Incorrect
The major version change (3) means big updates that might break compatibility.
How do you see all tags in your Git repository?
Agit show tags
Bgit list tags
Cgit tags --all
Dgit tag
✗ Incorrect
The command 'git tag' lists all tags.
Why use semantic versioning tags in Git?
ATo track changes clearly and help users know update types
BTo confuse users
CTo slow down development
DTo avoid using branches
✗ Incorrect
Semantic versioning helps everyone understand the type of changes in each release.
Explain semantic versioning and how it helps in managing Git tags.
Think about how you tell a friend if a new app update is big or small.
You got /4 concepts.
Describe the difference between lightweight and annotated Git tags and when to use each.
Imagine writing a quick note versus a detailed letter.
You got /4 concepts.
Practice
(1/5)
1. What does the PATCH number represent in semantic versioning like 1.4.2?
easy
A. Build metadata or pre-release information
B. New features added in a backward-compatible way
C. Major changes that break backward compatibility
D. Bug fixes and small changes that do not affect the API
Solution
Step 1: Understand semantic versioning parts
Semantic versioning uses MAJOR.MINOR.PATCH format where PATCH is the last number.
Step 2: Identify PATCH meaning
PATCH is for bug fixes or small improvements that do not change the API or features.
Final Answer:
Bug fixes and small changes that do not affect the API -> Option D
Quick Check:
PATCH = bug fixes [OK]
Hint: PATCH fixes bugs without changing features [OK]
Common Mistakes:
Confusing PATCH with MINOR or MAJOR
Thinking PATCH adds new features
Mixing PATCH with build metadata
2. Which git command correctly creates an annotated tag named v2.1.0 with a message?
easy
A. git tag -a v2.1.0 -m "Release version 2.1.0"
B. git tag v2.1.0 -m "Release version 2.1.0"
C. git tag -m "Release version 2.1.0" v2.1.0
D. git tag --message v2.1.0 "Release version 2.1.0"
Solution
Step 1: Recall annotated tag syntax
Annotated tags use -a and -m for message: git tag -a tagname -m "message".
Step 2: Match correct command
git tag -a v2.1.0 -m "Release version 2.1.0" matches this syntax exactly, others misuse flags or order.
Final Answer:
git tag -a v2.1.0 -m "Release version 2.1.0" -> Option A
Quick Check:
Annotated tag = git tag -a -m [OK]
Hint: Use -a and -m together for annotated tags [OK]
Common Mistakes:
Omitting -a for annotated tags
Placing -m before tag name incorrectly
Using --message instead of -m
3. Given these git tags: v1.0.0, v1.2.0, v1.2.3, what will git describe --tags output if the current commit is exactly at v1.2.3?
medium
A. v1.2.3
B. v1.2.3-0-g
C. v1.2.0
D. v1.2.3-1-g
Solution
Step 1: Understand git describe output
If the current commit matches a tag exactly, git describe --tags outputs just that tag name.
Step 2: Apply to given tags
Since current commit is exactly at v1.2.3, output is v1.2.3 without extra suffix.
Final Answer:
v1.2.3 -> Option A
Quick Check:
Exact tag commit = tag name only [OK]
Hint: Exact tag commit shows tag name only [OK]
Common Mistakes:
Expecting extra suffix even on exact tag
Confusing closest previous tag with current
Misunderstanding commit hash suffix
4. You tried to create an annotated tag with git tag -m "Release 1.0" v1.0.0 but it created a lightweight tag instead. What is the error?
medium
A. Using double quotes instead of single quotes for message
B. Incorrect order of arguments; message must come after tag name
C. Missing -a flag to create an annotated tag
D. Tag name v1.0.0 is invalid
Solution
Step 1: Check command syntax for annotated tags
Annotated tags require -a flag; -m alone creates lightweight tag with message ignored.
Step 2: Identify missing flag
The command lacks -a, so it made a lightweight tag instead of annotated.
Final Answer:
Missing -a flag to create an annotated tag -> Option C
Quick Check:
Annotated tag needs -a flag [OK]
Hint: Always use -a for annotated tags [OK]
Common Mistakes:
Omitting -a flag
Thinking -m alone creates annotated tag
Confusing argument order
5. You want to tag a release as v3.0.0 but only if the current commit is ahead of v2.9.9 by at least one commit. Which sequence of commands correctly checks this and creates an annotated tag if true?
hard
A. git describe --tags --match "v2.9.9" && git tag -a v3.0.0 -m "Release v3.0.0"
B. if [ $(git rev-list v2.9.9..HEAD --count) -gt 0 ]; then git tag -a v3.0.0 -m "Release v3.0.0"; fi
C. git tag -a v3.0.0 -m "Release v3.0.0" && git rev-list v2.9.9..HEAD --count
D. git tag v3.0.0 && git rev-list --count v2.9.9..HEAD
Solution
Step 1: Check commits ahead of v2.9.9
Use git rev-list v2.9.9..HEAD --count to count commits ahead.
Step 2: Conditional tag creation
If count is greater than 0, create annotated tag with git tag -a v3.0.0 -m "Release v3.0.0".
Final Answer:
if [ $(git rev-list v2.9.9..HEAD --count) -gt 0 ]; then git tag -a v3.0.0 -m "Release v3.0.0"; fi -> Option B