Git/C2/Tagging-in-Git/English-timed

From Script | Spoken-Tutorial
Revision as of 13:00, 13 April 2016 by Sandhya.np14 (Talk | contribs)

Jump to: navigation, search
Time
Narration
00:01 Welcome to the spoken tutorial on Tagging in Git.
00:06 In this tutorial, we will learn about:
  • Tagging and
  • Types of tagging.
00:12 For this tutorial, I am using:
  • Ubuntu Linux 14.04
  • Git 2.3.2 and
  • gedit Text Editor

You can use any editor of your choice.

00:28 To follow this tutorial-
  • You must have knowledge of running Linux commands on Terminal.
  • If not, for relevant Linux tutorials, please visit our website.
00:41 Let us learn about tagging.
00:44 * Tagging is used to mark a commit stage as important.
00:49 We can tag a commit, like a bookmark, for future references.
00:54 Typically, this is used to mark release point of a project such as v1.0.
01:02 There are two types of tags:
  • Lightweight tag and
  • Annotated tag
01:09 First, I will demonstrate how to create a lightweight tag.
01:15 Let us go to our Git repository mywebpage which we created earlier.
01:21 Switch back to the terminal and type: cd space mywebpage and press Enter.
01:30 I will continue to use html files for demonstration.
01:34 You may use any file type of your choice.
01:39 Let’s check the Git log by typing git space log space hyphen hyphen oneline and press Enter.
01:48 Currently, we have three commits in our repository ,namely- "Added colors, Added history.html" and the "Initial commit".
01:59 Now, I will create a lightweight tag in the latest commit “Added colors”.
02:05 When we create a tag, by default, it will be created in the latest commit.
02:12 Type: git space tag space v1.1 and press Enter.
02:20 Here, I will give v1.1 as the tag name. You can give any name of your choice.
02:29 You can see the tag by typing git space tag and press Enter.
02:35 Now, we have only one tag in our repository.
02:39 Next, we will learn how to create an annotated tag.
02:44 First, I will make some modifications in the file mypage.html for demonstration purpose.
02:52 Type: gedit space mypage.html space ampersand and press Enter. Let us add some lines in the file.
03:04 Then save and close the file.
03:07 Let’s commit our work at this point.
03:11 Type: git space commit space hyphen a m space within double quotes “Added content in mypage.html” and press Enter.
03:25 Let us assume that this particular stage is very important to the project.
03:31 So, we have to create a tag at this commit point.
03:35 Here, we will create an annotated tag.
03:39 Type: git space tag space hyphen a space v1.2 space hyphen m space within double quotes “My Version 1.2” and press Enter.
03:55 Using -m flag, you can give any tag message of your choice.
04:01 Here, the tag message is optional.
04:05 To see the tag list, type: git space tag and press Enter. Now we have two tags.
04:14 Here, v1.1 is the lightweight tag and v1.2 is the annotated tag.
04:21 How do we differentiate between the tags?
04:24 We can see the difference between the two tags by using git show command.
04:31 Type: git space show space v1.1 and press Enter.
04:38 Here, we can see the complete details of the lightweight tag v1.1.
04:44 It simply shows the commit details and the file changes.
04:50 Next, we will see the details of the annotated tag v1.2. Type: git space show space v1.2 and press Enter.
05:03 Here we can see the:
  • tag name
  • tagger details
  • date the commit was tagged
  • tag message
  • commit details and
  • file changes.
05:17 Annotated tag is always recommended when you work collaboratively.
05:23 Let us now learn how to mark a tag in our old commits.
05:29 First, we will check the Git log by typing git space log space hyphen hyphen oneline and press Enter.
05:39 Now, for instance, I want to create a tag in my second commit “Added history.html”.
05:47 Type: git space tag space hyphen a space v1.0 space. Then, copy and paste the commit hash of the “Added history.html” space type: hyphen m space within double quotes “My Version 1.0” and press Enter.
06:09 We will be able to see the tag which we created now, by typing git space tag and press Enter.
06:19 You can see the tag v1.0 is created here.
06:24 Next, we will learn how to see the tags along with the Git log.
06:29 Type: git space log space hyphen hyphen oneline space hyphen hyphen decorate and press Enter.
06:40 You can see the Git log along with the tag names.
06:44 Now, we will learn to delete an unwanted tag.
06:49 Say, I want to delete the tag v1.1.
06:53 Type: git space tag space hyphen d space v1.1 and press Enter.
07:02 It shows the message “Deleted tag 'v1.1'” and its commit hash.
07:08 We will check whether the tag is deleted or not.
07:14 Type: git space tag and press Enter.
07:19 Now, we can't see the tag v1.1 as it has been deleted successfully.
07:25 With this, we come to the end of this tutorial.
07:29 Let us summarize. In this tutorial, we have learnt about:
  • Tagging and
  • Types of tagging.
07:38 As an assignment-
  • Create a lightweight tag and an annotated tag and
  • Understand the difference between both the tags.
07:47 The video at the following link summarizes the Spoken Tutorial project. Please download and watch it.
07:56 The Spoken Tutorial Project team conducts workshops and gives certificates to those who pass online tests.
08:03 For more details, please write to us.
08:08 Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India.

More information on this mission is available at the following link.

08:20 This is Priya from IIT Bombay. Thanks for joining.

Contributors and Content Editors

PoojaMoolya, Sandhya.np14