Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»General Articles»How to Create Git tags

    How to Create Git tags

    By RahulOctober 25, 20212 Mins Read

    Tags work as an additional identifier for a particular incident. And in the case of Git, Tags are used as the reference points in your development workflow and it denotes special events like a new version release or new commit. You can create a new tag to give a reference for your newly launched version. Tagging helps you in identifying the particular commit or release of your code in past.

    Advertisement

    If you want to create Git tags, then you should know that there are two types of Git tags:

    • Annotated tags
    • Lightweight tags

    Annotated tags are tags with a description while lightweight tags don’t include any description. We will see how to create both of them one by one.

    Why should you create tags or what are the benefits of tags?

    • When you want to put a part of code or code point for future use reference. The tag will help you in identifying that part.
    • While creating a stable version of your code or release point.

    Now let’s see how you can create tags.

    1. To create a git tag, we use the “git tag” command and then specify the name of the tag. For example:
      git tag [tagName]
      

      So if you are creating a new tag for your latest launch then you can execute:

      git tag v1.4 
      

      Next, you can run the “git tag” command to see if you have successfully created the tag or not. This syntax will list all the existing tags.

    2. If you want to create a tag with a message then you can execute the following command.

      git tag -a [tagName] -m “Your message here”

      For example:

      git tag -a v1.4 -m "This is the new release" 
      

      You can even verify your tag by using the following command:

      git tag -n 
      

      This will display all the existing tags with messages.

    3. Your git push command will not be pushed to your remote repository automatically. And to push them you have to execute the following command:
      git push --tags 
      

    git tags
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    20 Basic Linux Commands for the Beginners (Recommended)

    tail Command in Linux with Examples

    What is a Orphan Process in Unix/Linux

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • 20 Basic Linux Commands for the Beginners (Recommended)
    • tail Command in Linux with Examples
    • What is a Orphan Process in Unix/Linux
    • How To Display Warning Message to Unauthorized SSH Access
    • How to Set a Custom SSH Login Banner and MOTD
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.