Lesson05
beginnerMark Releases with git tag
Goal
Name commits with tags, the way projects mark their releases, and clean up a tag you no longer want.
The weather app is ready for its first release. Branches move with every commit, so they are no good for remembering "this is exactly what we shipped". A tag is a name for one commit that stays put.
Mark the preview build, tag the release itself, and remove a tag someone made by mistake.
Objectives
0/3- A lightweight tag
v0.9marksAdd forecast panel. (Current objective) - An annotated tag
v1.0marksFix rounding in forecast. (Not started) - The stray
temp-releasetag is gone. (Not started)
Your task nowStep 1 of 3
A lightweight tag v0.9 marks Add forecast panel.
Need help?
Reference
Branches move, tags do not
A branch
- Moves forward with every commit
- Names the work in progress
git switchmoves you onto it
A tag
- Stays on one commit for good
- Names a moment, such as a release
git switch --detach v1.0visits it
Two kinds of tag
Lightweight — git tag v0.9
- Just a name pointing at a commit
- Good for a private bookmark
Annotated — git tag -a v1.0 -m "…"
- A tag object with its own message, author and date
- What releases use;
git tag -nshows the message
Tags in the history
$ git log --oneline
8d4c21e (HEAD -> main, tag: v1.0) Fix rounding in forecast 52c9e10 (tag: v0.9) Add forecast panel 1f0e6d2 Initial commit
git log decorates tagged commits with tag:. Without a commit, git tag tags HEAD; name a commit to tag an older one: git tag v0.9 HEAD~1.
Preparing your workspace…
Repository Graph
Click a commit to inspect it
Working Tree
Not a Git repository yet
No unstaged changes
Your working tree matches the staging area.
Staging Area
Files prepared for the next commit
No staged changes
Use git add to prepare files for your next commit.
Repository
Committed history
No commits yet
Use git commit to record staged changes.
