Branches and remotes
Tags
4 min read
A tag marks a commit with a fixed name, usually a version (v1.4.0). Unlike a branch, it doesn't
move along with new commits. There are two kinds:
- lightweight tag: just a name pointing to the commit;
- annotated tag: also keeps a message, author and date. It's the recommended one for published versions.
Tags are in the left panel's TAGS section and show up as labels in the graph.
- A commit's menu: Create tag here… and Create annotated tag here….
- A branch's menu (local or remote): the same items, at the end of the menu. The tag goes on the commit at the tip of the branch.
- The graph's ghost branch: the tag icon next to the name field (see Graph).
- To produce the whole version (changelog, manifests, commit and tag), use New version… (see Hygiene and flow).
- Right-click the commit and choose Create annotated tag here….
- The Create annotated tag dialog shows the commit ("At 3f2a9c1").
- Fill in Tag name (for example,
v1.4.0) and Tag message (required for an annotated tag). - Click Create.
The tag is created only on your machine. For others to see it, push it (see below).
| Field | Lightweight tag | Annotated tag |
|---|---|---|
| Tag name | required | required |
| Tag message | doesn't show up | required |
git tag v1.4.0 3f2a9c1 # lightweight tag
git tag -a v1.4.0 -m "Version 1.4.0: monthly report" 3f2a9c1 # annotated tag
Ctrl+Z undoes "Create tag v1.4.0": the local tag is removed.
Right-click a tag (TAGS section or a label in the graph). The menu has:
| Item | What it does |
|---|---|
| Check out the commit at v1.4.0 | Checks out the tag's commit, in detached HEAD (see Checkout). Double-clicking the tag does the same. |
| Create branch here… | Creates a branch from the tag (for example, hotfix/1.4.1). |
Push v1.4.0 to › origin (or all remotes) | Sends the tag. |
| Delete v1.4.0 locally | Deletes the tag only on your machine. |
Delete v1.4.0 from remote › origin (or all remotes) | Deletes the tag on the server. The local tag stays. |
| Create release on GitLab… (or on GitHub…) | Creates the release of a tag that's already on the server (see Hygiene and flow). |
| Browsing the files, exporting a ZIP, Compare v1.4.0 with… | See Inspection. |
| Copy tag name and Copy Versora link to tag: v1.4.0 | Copy the name or a versora:// link to the tag. |
The all remotes submenu only shows up when the repository has more than one remote. With no remote, the push and remote deletion items are disabled.
Pushing a branch doesn't send the tags. Send each tag from its menu.
- In the tag's menu, choose Push v1.4.0 to ›
origin. - The bar shows "Pushing tag…".
- At the end, "Pushed tag v1.4.0 to origin" shows up.
git push origin refs/tags/v1.4.0
# "all remotes": the same command for each remote
Delete v1.4.0 locally deletes the tag without asking. Ctrl+Z undoes "Delete tag v1.4.0" and the tag comes back. A fetch brings the tag back if it still exists on the remote (Versora's fetch gets the tags).
git tag -d v1.4.0
- Choose Delete v1.4.0 from remote ›
origin. - If the remote's push rules forbid deleting tags, the Delete tag v1.4.0 on the remote? dialog opens first explaining the rule, with Delete anyway (see Push rules).
- The Delete v1.4.0 from remote dialog warns: "Tag "v1.4.0" will be deleted on origin for everyone. The local tag isn't affected."
- Click Delete from remote. At the end, "Deleted tag v1.4.0 from origin" shows up.
git push origin --delete refs/tags/v1.4.0
Ctrl+Z doesn't bring the tag back to the server. If the local tag still exists, push it again.
- The left panel's TAGS section. With many tags, the section shows the first 300 and says "+N more tags — use the filter to find them": type in the panel's filter (Ctrl+Alt+F).
- Palette (Ctrl+P): type
tagand the name. Choosing the tag selects its commit in the graph. A tag beyond the loaded commits shows up as unavailable. - Hover over the tag's label in the graph to see the annotation (message, author, date and whether it's signed). See Graph.
- Git refuses to create a tag with a name that already exists: choose another name or delete the old one.
- Moving a tag that has already been published disrupts whoever already fetched it. Prefer creating a new version.
- The TAGS section can be hidden in the graph from the header menu ("Hide all tags").
- The
deny_delete_tagpush rule (on GitLab or in.versora/push-rules.json): makes Versora warn before deleting a tag on the remote.