Today I got fed up with some of the quirks of TFS, and decided to try git, to see whether I could set it up so that I would be developing under git, setting up a water-proof system integrating with TFS some way or another.

Here's how to get started with git on windows:

  • Installing git: just run the windows installer from The installer lets you choose whether to add Git to the PATH environment variable (so git is available in the Windows command prompt). You can also opt to exclusively use the BASH shell that comes with the installer.
  • Configuring Git: at the command prompt, type the following commands:
      git config --global "Your Name Here"
      git config --global "YourEmail@YourDomain"
  • Importing code:
      git init
      git add *
      git commit -m "initial commit"

For actually synchronizing TFS with git, I think the following scheme may work, but I'm not entirely satisfied with it yet. For now, I created just one branch, 'working' (using 'git branch working'). I'm synchronizing my git environment with TFS as follows:

  • in TFS, do a 'get latest version'
  • in git, make sure everything is committed in branch 'working' + switch the 'git' working copy to 'master' (using 'git checkout master')
  • sync the TFS working copy to the git working copy (I'm using robocopy for this)
  • commit the TFS changes the 'master' branch (git commit -a -m "get latest version from TFS")

Then, I merge my own changes from 'working' to 'master' (git merge working) and still need to synchronize everything back to TFS.

For this I need to

  • check out all files changed by the merge (working -> master)
  • copy all changed files from git -> tfs working copy
  • check in in TFS

I'm not yet entirely satisfied with this scheme (I don't really like the 'robocopy' steps), but I'm not sure if there is a better way at this point...