Skip to content
Nov 26 / davidalpert

A faster way to find the url for a git-tfs remote

Last fall I posted about how to find the url for a git-tfs remote; at that time it was a manual process of digging through the [repo]/.git/config file.

Since then I’ve gotten my hands dirty in the git-tfs source code and added a few features, one of which is the addition of an entirely new command:

  • git tfs info

Similar to the ‘svn info’ command, ‘git tfs info’ is a convenience command that dumps to the console some details about the current git-tfs repository, including:

  • the version of git begin used;
  • the version of git-tfs.exe that is running the command;
  • the filepath to the specific git-tfs.exe that is running the command;
  • the remote tfs id, url, and path relative to the collection;
  • the local git remote ref;
  • the commit hash and changeset number of the nearest parent commit that maps to a TFS changeset.

In practice, it looks like this (actual paths have been changed to protect the innocent):

/c/tfs/dev/main.git-tfs (master)
$ git tfs info 

git version 1.8.0.msysgit.0  
git-tfs version 0.15.1.0 (TFS client library 10.0.0.0 (MS)) (32-bit)
c:\Users\davida\bin\git-tfs\git-tfs.exe  
remote tfs id: 'default' http://yourtfs01:8080/tfs/ $/your_team_project/Source/Main
               refs/remotes/tfs/default - 6c938a52c4bc71bd508c18e9f8cfcf9c65b2683d @ 17220 

As a contributor hacking on the git-tfs source code, the path to the running instance of git-tfs.exe has come in handy.