Derik Whittaker



How to migrate your TFS Repository to GitHub

So it has begun.  We have been using TFS at work for 2+ years and the time has come to move off of TFS and over to GitHub (we have a few reasons, most of which I am going to avoid for this post as they do not add any real value).  Normally when you are going from one system to another you have to run some sort of conversion, this is kinda true here, but not 100%.  In this case we are going to be doing a conversion and a publication, both of which are simple.

The basic idea of what we are going to be doing is:

Clone from TFS –> Push to GitHub –> have a beer :)

Really, moving from TFS to GitHub (or git in general) is really easy, but does involve a few steps

  1. Install Chocolately
  2. Install GitTFS (chocolately package) – this is a tool which allows you to use git syntax w/ your TFS repository
  3. Open up a Visual Studio Command prompt
  4. CD into the directory you whish to clone into
  5. Clone your TFS repo locally via Git TFS
    There are 2 different ways to do this, you can do a full clone which includes all your commit history or you can do a quick-clone which does not

    Clone (this could take a really long time, like hours so be warned)
    git tfs clone http://[YourTFSServerHere]:8080/tfs/DefaultCollection $/[NameOfFolderHere]

    Quick Clone
    git tfs quick-clone http://[YourTFSServerHere]:8080/tfs/DefaultCollection $/[NameOfFolderHere]
  6. Create your repository on GitHub (I found this was just the simplest way)
  7. Go back to your command prompt (ensure you are in the directory that has your files)
  8. Do a git push via
    git push[GitHubAccountNameHere]/[RepositoryNameHere] master

    Make sure you put master as you need to tell it what branch to do the push to.
  9. Go verify your code is in GitHub
  10. Your done

As you can see getting all your files out of TFS and into GitHub is pretty simple, but does involve a few steps (and possibly a few hours depending on how much commit history you have in TFS).

Hope this helps,

Till next time,

Posted 09-09-2012 6:17 AM by Derik Whittaker
Filed under: ,



JoshuaS wrote re: How to migrate your TFS Repository to GitHub
on 09-09-2012 8:16 AM

What, if anything, are you using in Visual Studio to show which files you've modified prior to a commit? I really like using Git repos but part of me don't want to give up all of the built-in visual indicators and other tools TFS provides.

Derik Whittaker wrote re: How to migrate your TFS Repository to GitHub
on 09-09-2012 8:25 AM


Right now I have been using the Windows GitHub client.  This means nothing is visible in VS.  However, we may use something like bit not sure.  

Honestly the Windows client for GitHub rocks and I am a former SVN guy w/ no VS integration so I dont really need/want something in VS.

Brian Dukes wrote re: How to migrate your TFS Repository to GitHub
on 09-10-2012 9:58 AM

You'll probably want to include the --no-metadata flag when cloning, so that you don't have the TFS integration stuff in your git commit messages.

Kamran wrote re: How to migrate your TFS Repository to GitHub
on 09-10-2012 11:07 AM

Also seconding the GitHub for Windows. I love it to death for .NET development, as before I had to work through the command line. GH4W has essentially made the command line obsolete except for certain circumstances and the team has been doing a great job keeping it updated and fixing bugs.

Ramon Smits wrote re: How to migrate your TFS Repository to GitHub
on 09-13-2012 3:17 AM

I love git bit you are just converting you TFS structure to ONE git repository. TFS Branches are not converted to GIT branches. So to me your strategy seems a bit flawed.

Dave Schinkel wrote re: How to migrate your TFS Repository to GitHub
on 10-01-2012 12:09 AM

Good article, because I hate TFS.

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Google Reader or Homepage Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of
Red-Gate Tools For SQL and .NET


SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
NHibernate Profiler
Balsamiq Mockups
JetBrains - ReSharper
Web Sequence Diagrams
Ducksboard<-- NEW Friend!


Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers


Community Server (Commercial Edition)