top of page

Tagging Releases

Objective: The objective of this assignment is to learn how to tag releases in a Git repository. You will create tags for specific project versions, and understand how tags can be used to mark important milestones in a software project's history.


Instructions:


Part 1: Repository Setup 


1. Task 1: Create a new directory on your computer for this assignment and name it "GitTaggingAssignment."


2. Task 2: Navigate to the "GitTaggingAssignment" directory in your terminal or command prompt.


3. Task 3: Initialize a new Git repository in this directory.


4. Task 4: Create a new text file named "README.md" in the repository.


Part 2: Making Commits 


1. Task 1: Open the "README.md" file using a text editor or a command-line text editor like Vim or Nano.


   

   nano README.md  # Use your preferred text editor

   


2. Task 2: Add some content to the "README.md" file. For example:


   

   # Git Tagging Assignment


   This is the main README file.

   


3. Task 3: Save the changes to the "README.md" file and exit the text editor.


4. Task 4: Commit the changes to the repository.


   

   git add README.md

   git commit -m "Initial commit: Add README"

   


Part 3: Tagging Releases 


1. Task 1: Create a new tag for the initial release of your project. Name the tag "v1.0."


   

   git tag v1.0

   


2. Task 2: Verify that the tag has been created successfully.


   

   git tag

   


   You should see the "v1.0" tag listed.


3. Task 3: Push the newly created tag to the remote repository.


   

   git push origin v1.0

   


Part 4: Modifying and Retagging 


1. Task 1: Make some changes to the "README.md" file.


   

   nano README.md

   


   Modify the content, save, and exit.


2. Task 2: Commit the changes.


   

   git add README.md

   git commit -m "Modify README"

   


3. Task 3: Create a new tag "v1.1" for this modified version.


   

   git tag v1.1

   


4. Task 4: Verify that the "v1.1" tag has been created.


   

   git tag

   


5. Task 5: Push the new tag to the remote repository.


   

   git push origin v1.1

Solutions

Part 1: Repository Setup



# Task 1

mkdir GitTaggingAssignment


# Task 2

cd GitTaggingAssignment


# Task 3

git init


# Task 4

touch README.md



Part 2: Making Commits



# Task 1

nano README.md  # Use your preferred text editor


# Task 2

# Add content to README.md and save


# Task 4

git add README.md

git commit -m "Initial commit: Add README"



Part 3: Tagging Releases



# Task 1

git tag v1.0


# Task 2

git tag  # To verify the tag


# Task 3

git push origin v1.0



Part 4: Modifying and Retagging



# Task 1

nano README.md  # Modify content, save, and exit


# Task 2

git


 add README.md

git commit -m "Modify README"


# Task 3

git tag v1.1


# Task 4

git tag  # To verify the new tag


# Task 5

git push origin v1.1

bottom of page