mirror of
https://github.com/jbranchaud/til
synced 2026-09-01 01:01:46 +00:00
Add Mark A Release With An Annotated Tag as a Git TIL
This commit is contained in:
@@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/).
|
||||
|
||||
For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter).
|
||||
|
||||
_1848 TILs and counting..._
|
||||
_1849 TILs and counting..._
|
||||
|
||||
See some of the other learning resources I work on:
|
||||
|
||||
@@ -410,6 +410,7 @@ If you've learned something here, support my efforts writing daily TILs by
|
||||
- [List Most Git Commands](git/list-most-git-commands.md)
|
||||
- [List Untracked Files](git/list-untracked-files.md)
|
||||
- [List Untracked Files For Scripting](git/list-untracked-files-for-scripting.md)
|
||||
- [Mark A Release With An Annotated Tag](git/mark-a-release-with-an-annotated-tag.md)
|
||||
- [Move The Latest Commit To A New Branch](git/move-the-latest-commit-to-a-new-branch.md)
|
||||
- [Override The Global Git Ignore File](git/override-the-global-git-ignore-file.md)
|
||||
- [Pick Specific Changes To Stash](git/pick-specific-changes-to-stash.md)
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
# Mark A Release With An Annotated Tag
|
||||
|
||||
There are two kinds of tags in Git -- lightweight tags and annotated tags.
|
||||
|
||||
The [`git-tag` docs](https://git-scm.com/docs/git-tag) explain the distinction:
|
||||
|
||||
> Annotated tags are meant for release while lightweight tags are meant for
|
||||
> private or temporary object labels.
|
||||
|
||||
When an annotated tag is created, a _tag object_ is created which has a creation
|
||||
timestamp, a "tagger" (who created it), a message, and potentially a signature
|
||||
if GPG commit signing is configured.
|
||||
|
||||
I can create an annotated tag for the `HEAD` commit like so:
|
||||
|
||||
```bash
|
||||
❯ git tag -a v0.1.0 -m "Release v0.1.0"
|
||||
```
|
||||
|
||||
I can then inspect what was created in a number of ways using `git tag --list`,
|
||||
`git show`, `git cat-file`, and `git log --show-signature`.
|
||||
|
||||
```bash
|
||||
❯ git tag --list
|
||||
v0.1.0
|
||||
|
||||
❯ git show --no-patch v0.1.0
|
||||
tag v0.1.0
|
||||
Tagger: jbranchaud <jbranchaud@gmail.com>
|
||||
Date: Sun, 2 Aug 2026 13:57:37 -0500
|
||||
|
||||
Release v0.1.0
|
||||
|
||||
commit 8a533ecfda526ebd1a4695639830f5620dd8572d (HEAD -> main, tag: v0.1.0, origin/main, origin/HEAD)
|
||||
Author: jbranchaud <jbranchaud@gmail.com>
|
||||
Date: Sun, 2 Aug 2026 12:51:41 -0500
|
||||
|
||||
Add changelog with v0.1.0 release changes documented
|
||||
|
||||
❯ git cat-file -t v0.1.0
|
||||
tag
|
||||
|
||||
❯ git cat-file -p v0.1.0
|
||||
object 8a533ecfda526ebd1a4695639830f5620dd8572d
|
||||
type commit
|
||||
tag v0.1.0
|
||||
tagger jbranchaud <jbranchaud@gmail.com> 1785697057 -0500
|
||||
|
||||
Release v0.1.0
|
||||
|
||||
❯ git log --show-signature
|
||||
commit 8a533ecfda526ebd1a4695639830f5620dd8572d (HEAD -> main, tag: v0.1.0, origin/main, origin/HEAD)
|
||||
gpg: Signature made Sun Aug 2 13:57:09 2026 CDT
|
||||
gpg: using RSA key B2570A9DA3E2A537781501B11A8656918A8D016B
|
||||
gpg: Good signature from "jbranchaud <jbranchaud@gmail.com>" [ultimate]
|
||||
Author: jbranchaud <jbranchaud@gmail.com>
|
||||
Date: Sun, 2 Aug 2026 12:51:41 -0500
|
||||
|
||||
Add changelog with v0.1.0 release changes documented
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
This tag will be included in a push when I run either of the following:
|
||||
|
||||
```bash
|
||||
❯ git push origin main
|
||||
❯ git push origin v0.1.0
|
||||
```
|
||||
|
||||
This tag, which is now tied to a _release_, can be seen at [_Releases /
|
||||
v0.1.0_](https://github.com/jbranchaud/py-vmt/releases/tag/v0.1.0) on GitHub.
|
||||
|
||||
See `man git-tag` for more details.
|
||||
Reference in New Issue
Block a user