Wednesday, September 12, 2012

How to migrate your TFS Repository to GitHub

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 http://github.com/[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,


DIGITAL JUICE

No comments:

Post a Comment

Thank's!