Getting Started With Git-TF Tool


Git-TF tool release by Microsoft allowing developers to work locally using Git repository without any connection to TFS, if you wanted to work on your files locally (In case you don’t have internet connection) you had reopen the solution and work offline. TFS 2012 comes with new feature called – Local Workspace allowing developers to work locally on their files but without tracking the changes history – here comes Git-TF tool.

Brian Harry’s Blog

Distributed Version Control (DVCS) has a growing following. It enables a set of workflows that can be very handy and Git is an increasingly popular DVCS solution.  Today, we are announcing Git-tf, a solution that enables you to work locally with a Git repo – edit, commit, revert, branch, merge, etc.  and then “sync up” with a central TFS repository.  In this way, you can have the best of both DVCS and TFS.

Getting Started with Git-TF Tool


  1. Download Microsoft Git-TF for Visual Studio Team Foundation Server 2012
  2. Extract the zip content to C:\git-tf (or any other place)
  3. Add the path where you extracted Git-TF (i.e. C:\git-tf) to your PATH environment variable.




  4. Download Java from and add the Java path to your PATH environment variable.  (Step 2)
  5. Download Git for Windows, and install it.

Setup Git User Information

  1. Open PowerShell and execute the following commands:

PS C:\> git config –global "shai.raiten[at]"
PS C:\> git config –global "Shai Raiten"

TFS Source Control

I’ve create new Team Project called – Agile, and added new console application under Main folder.


The first thing before we can start using Git-TF tool is initializes a new git repo from an existing path in a TFS server using the clone command.

Run: git-tf clone http://TFSServerName:8080/tfs "$/Agile/Main”


PS C:\Users\Shai\Dev> git-tf clone http://lucy:8080/tfs "$/Agile/Main"
Connecting to TFS…
Cloning $/Agile/Main into C:\Users\Shai\Dev\Main: 100%, done.
Cloned changeset 19 as 6195f2e
PS C:\Users\Shai\Dev>

Change some files under your new Git repository.


I’ve also create new file (Program – Duplicate.cs)


To apply new change we’ll use the commit command:

Run: git commit -a -m "Add new file and new comment…"


PS C:\Users\Shai\Main> git commit -a -m "Add new file and new comment…"
[master 2feccf1] Add new file and new comment…
1 file changed, 1 insertion(+)
PS C:\Users\Shai\Main>

Now, let’s make things more complicated, I’ve checked in new change from TFS (Adding new comment)


Before you checked in your local git repository changes to TFS you want to fetches changes made in TFS as a new commit in Git, and merges the commit with the latest commit in the current branch.

Run: git-tf pull –rebase


PS C:\Users\Shai\Main> git-tf pull –rebase
Connecting to TFS…
jgit : Obtaining commits that need to be cherry-picked
jgit : Rewinding to commit Add new Comment – TFS
jgit : Applying Add new file and new comment…
Fetching and merging changes in $/Agile/Main at latest changeset: 100%, done.
All files were fetched to commit 1f59bb6. The rebase operation was stopped, please fix the issues and run "git rebase —
continue" to complete the operation.
PS C:\Users\Shai\Main>

We can see we have a conflict with TFS, if you open the the conflicted file you’ll see TFS and Git changes separated by OURS and THIERS comments.


Modify the file to resolve the conflict, and run git rebase –continue command to fix the conflict.


After we make sure there is no more conflict we can check in the Git repository changes to TFS by running the following command:

Run: git-tf checkin


PS C:\Users\Shai\main> git-tf checkin
Connecting to TFS…
Checking in to $/Agile/Main: 100%, done.
Checked commit de1ca4c in as changeset 21

Now we can see Git changes in TFS Source Control.



Add comment
facebook linkedin twitter email

Leave a Reply