1 of 12

PROJECT MANAGEMENT (WITH GIT)

1BCSL307A

2 of 12

Experiment 7 – Git Tags and Releases:

​

Write the command to create a lightweight Git tag named "v1.0" for a commit in your local repository

2

3 of 12

Tagging

3

4 of 12

Git Tagging

  • Git has the ability to tag specific points in a repository’s history as being important.
  • Used to mark release points (v1.0, v2.0 and so on)
  • Listing your tags
  • git tag
  • Optional -l or --list
  • Search for tags to match a particular pattern
  • git tag -l “v1.8.5*”
  • For wildcards –l or --list is required
  • Creating Tags
    • 2 types : lightweight, annotated
  • A lightweight tag is very much like a branch that doesn’t change — it’s just a pointer to a specific commit.

​

4

5 of 12

Annotated Tags

  • stored as full objects in the Git database
  • They’re checksummed
  • contain the tagger name, email, and date
  • have a tagging message
  • can be signed and verified with GNU Privacy Guard (GPG).
  • Creating annotated tags
  • git tag -a v1.4 -m "my version 1.4“
  • -m specifies the tagging message
  • -a creates an annotated tag
  • Use git show to see the information stored

​

5

hp-pc flask-ecom (master)

$ git tag -a v1.0 -m "version 1.0"

hp-pc flask-ecom (master)

$ git tag

v1.0

hp-pc flask-ecom (master)

$ git show

commit 0e872b6283b4d750edbf0f5b7e88fa1b5870a46d (HEAD -> master, tag: v1.0, orig

in/master, origin/HEAD)

Author: Preethi Sheba <preethi.hepsiba@gmail.com>

Date: Sun Oct 11 22:47:08 2026 +0530

​

Add coupon

@@ -0,0 +1 @@

+calculate_discount

6 of 12

Lightweight Tags

  • the commit checksum stored in a file — no other information is kept
  • To create a lightweight tag, don’t supply any of the -a, -s, or -m options, just provide a tag name
  • The information comes from commits

​

6

hp-pc flask-ecom (master)

$ git tag v1.0a

g

hp-pc flask-ecom (master)

$ git tag

v1.0

v1.0a

To verify

  • To verify, use git cat-file <option> <version>
  • -t to display the type
  • -p to pretty print objects contents
  • git rev-parse <object> - used to convert git references to their corresponding IDs(checksums)

7 of 12

Verifying

7

hp-pcflask-ecom (master)

$ git cat-file -t v1.0

tag

​

hp-pcflask-ecom (master)

$ git cat-file -t v1.0a

commit

​

hp-pcflask-ecom (master)

$ git rev-parse v1.0

7d38b4d729f77095f161f7c2ab22acec57e55c03

​

hp-pcflask-ecom (master)

$ git rev-parse v1.0a

0e872b6283b4d750edbf0f5b7e88fa1b5870a46d

​

​

hp-pcflask-ecom (master)

$ git cat-file -p v1.0

object 0e872b6283b4d750edbf0f5b7e88fa1b5870a46d

type commit

tag v1.0

tagger Preethi Sheba <preethi.hepsiba@gmail.com> 1793540956 +0530

​

version 1.0

​

hp-pcflask-ecom (master)

$ git cat-file -p v1.0a

tree b4f44834f05b18b4ba662a62c08bf0caec62ad9b

parent 17022dbc1a6b4de3e5506b4042cc837b52244237

author Preethi Sheba <preethi.hepsiba@gmail.com> 1791739028 +0530

committer Preethi Sheba <preethi.hepsiba@gmail.com> 1791739292 +0530

8 of 12

Tagging later

  • Tagging a previous commit
  • Use the checksum

​

8

Sharing tags

  • git push command doesn’t transfer tags to remote servers
  • git push origin <tagname>.

hp-pc@flask-ecom (master)

$ git log --pretty=oneline

0e872b6283b4d750edbf0f5b7e88fa1b5870a46d (HEAD -> master, tag: v1.0a, tag: v1.0,

origin/master, origin/HEAD) Add coupon

17022dbc1a6b4de3e5506b4042cc837b52244237 Update app.py

426e9961ce458dfbb1b304912a3b898f9bd5db63 Initial commit

​

hp-pc@flask-ecom (master)

$ git tag -a v0 426e -m "Initial commit tag”

​

hp-pc@flask-ecom (master)

$ git tag -d v0

Deleted tag 'v0' (was 5158deb)

​

hp-pc@flask-ecom (master)

$ git tag

v1.0

v1.0a

​

Deleting Tags

  • can use git tag -d <tagname>.
  • To delete from remotes: git push origin --delete <tagname>

9 of 12

Viva

9

1. What is the primary purpose of Git tagging?

A. To create a new branch�B. To mark a specific commit�C. To delete a commit�D. To merge branches

2. Which command creates a lightweight tag named v1.0?

A. git tag -a v1.0�B. git branch v1.0�C. git tag v1.0�D. git commit v1.0

10 of 12

Viva

3. Which type of tag contains the tagger's name, email, date, and a message?

A. Lightweight tag�B. Annotated tag�C. Branch tag�D. Remote tag

4. Which command displays all tags in a Git repository?

A. git branch�B. git log�C. git show�D. git tag

10

11 of 12

Viva

11

5. Which command creates an annotated tag named v2.0?

A. git tag v2.0�B. git tag -a v2.0 -m "Version 2.0"�C. git branch -a v2.0�D. git commit -tag v2.0

12 of 12

Viva

  1. Answer: B To mark a specific commit, usually representing a release or milestone
  2. Answer: C git tag v1.0
  3. Answer: B Annotated tag
  4. Answer: D git tag
  5. Answer: B git tag -a v2.0 -m "Version 2.0"

​

​

​

​

​

12