Thursday, April 30, 2015

TFS Git Basics - Tagging

Tagging

Like most VCSs, Git has the ability to tag specific points in history as being important. Typically people use this functionality to mark release points (v1.0, and so on).

In this post, you will learn how to tag using TFS Git.

Before You Start

In order to use tags, you have to open "Command Prompt" from "Unsynced Commits".


Listing Your Tags

Listing the available tags in Git is straightforward. Just type git tag.

Creating Annotated Tags

Git uses two main types of tags: lightweight and annotated. I’ll focus on annotated tags using the following command as an example:
git tag -a v1.4 9fceb02

  • To specify an annotated tag, you have to specify –a When you run the tag command.
  • v1.4: is the tag name.
  • 9fceb02: is a part of the commit identifier you want to tag (Part of the commit identifier is enough).
You’ll then find a VM window asking you to enter the message, write down the message then press ESC then write :wq then press Enter.

Sharing Tags

By default, the git push command doesn't transfer tags to remote servers. You will have to explicitly push tags to a shared server after you have created them. This process is just like sharing remote branches – you can run:
git push origin [tagname]

If you have a lot of tags that you want to push up at once, you can also use the --tags option to the git push command. This will transfer all of your tags to the remote server that are not already there.
git push origin --tags

In order to be able to view pushed tags as a different team member, you have to run the following command from command prompt:
git fetch --tags

2 comments:

  1. Thanks, this helped me release WinjiGo 1.1 :) .. but it will be better if you explained unclear commands like ":wq"

    ReplyDelete
  2. ':' enters command input mode, 'w' writes to disk and 'q' quits the program.

    ReplyDelete