Using Git Tag for Visual Studio Projects

2014-05-11


Visual Studio 2013 does not provide Git Tag function before Update 2, current the Visual Studio 2013 update 2 is still not formally released but just a RC release, so there are lots of developers are still using old Visual Studio 2013, which can not add git tag using Visual Studio 2013 directly.

So, we have to use Git command line.

Here I do not want to talk about install 3rd party Git command tools or related security settings, what I want to below is that I suppose you have done the some pre-settings things, if you did not, check here first, you must done those settings and installations before you read below content.

Go to Team Exporer in Visual Studio 2013 and find the Actions, and select Open Command Pompt from Actions link.

image

Now you come to Git command line:

**List existing tags: git tag  -l
Or, just use: git tag **

image

Add a new tag:

Normally, we do not want the git command line open an extra editor to let us input details information since some default editors is nightmare for a regular Windows user, so we use Annotated Tags which including extra –m parameter to give a git tag message:

git tag -a v1.0 -m 'my version 1.0 message'
(Note: if you see ‘fatal: too many params after you input above format, change quoting sign to double quotes, the reason is current command line does not support single quote sign)

The next is that you have to push your new tag to remote Git repository.

git push origin - - tags (push all created tags which have not pushed to remote repository yet)

git push origin v1.0  (push a specific tag)

(Note: when you push the tag, you will be asked to input your remote Git repository account information, which you used the account to add the tag)

image

Now you go to Visual Studio online or Visual Studio 2013, you will see a new tag has set in version history list.

_ About origin: Git has the concept of "remotes", which are simply URLs to other copies of your repository. When you clone another repository, git automatically creates a remote named "origin" and points to it._

So we see the tag adding is not convenient if you only use Visual Studio 2013 to use Git source control, but I heard the tag feature will be available in Visual Studio Update 2, I hope update 2 formal version comes earlier.