Migrate TFS 2013 to Git

During the past 24 hours I’ve been struggling with the following.

As our dev team uses TFS (current version 2013) for quite some time, we decided to migrate all of the projects to git.

  • Git submodule password prompt
  • How do you rename a Git tag?
  • Finding out which files are version controlled that now match the current .gitignore
  • How do you push from nitrous.io to GIT
  • git tracking submodule files from “super project”
  • Popularity of Git/Mercurial/Bazaar vs. which to recommend
  • But unfortunately, this doesn’t look to be so easy. First of all, I’ve tried with git tfs, but every time I try to clone a collection it says:

    Access to path 'x' denied. 

    In contrary, listing all of the branches runs smoothly.

    Because of that, I was trying to go the way around by trying to convert a TFS repository into a TFS Git repository which would allow me to clone it and push it to our BitBucket repo. Unfortunately, I cannot find how to convert a TFS repository to a TFS Git repository – only found how to create an existing.

    Last but not least, I have even tried with git tf – but every time I try to access my repos it says: “Java….Main.class” not found.

    Any tips and tricks onto how to successfully migrate from TFS to Git?

    Thanks in advance!

  • why is heroku telling me to update CLI when i just downloaded it?
  • Why does a conflict occur for only one commit instead of two in my rebase operation?
  • How do I enable ident string for Git repos?
  • Tagging git submodules with release
  • (Heroku/GIT) Comments added to commit command not appearing in activity
  • git: How to work on subdirectory
  • 2 Solutions collect form web for “Migrate TFS 2013 to Git”

    TFVC and Git are radically different version control models (see https://en.wikipedia.org/wiki/Version_control for additional information): it is like moving your data from Files&Directory to a Relational DBMS or comparing an electric car to an internal combustion engine.

    My suggestion is going back to the basics and state the requirements clearly. :

    • Do I need to migrate all my source code?
    • Do I need migrate history?
    • Do I need all the branches?

    My recommendation is to focus on what you really need and go for quickest and cheapest solution which is usually:

    1. Move to the new system only the source files I need and get rid of old unused stuff (call it garage cleaning)
    2. Lock down the old system to be read-only
    3. Take a snapshot of a minimum of branches and commit them to the new system (no special tools needed)
    4. Do not migrate before a major release, choose the moment wisely so teams have time to learn the new technology and fix issues
    5. Start using the new system and leave the old as a reference

    Item 2 can be implemented by removing permissions to everyone except administrators. My idea of step 3 is: clone empty repo, get latest of main branch in separate TFVC workspace, sync the files to the Git repo (e.g. robocopy /MIR /XD .git), commit, push, create and switch Git to branch X, get latest TFVC branch X, sync, etc. Repeat for all the branches you want to migrate.

    Consider also some minor refactoring of the code base layout and splitting into separate Git sub-trees or even sub-modules.

    Unfortunately, I cannot find how to convert a TFS repository to a TFS Git repository

    Just because there is no way to do it! It’s a very difficult task, due to git and TFVC specificities, so Microsoft never even tried to do it!

    In a sense, that’s what the tools git-tfs and git-tf are trying to do with a lot of difficulties, mostly due how (horrible!) TFVC manage and store branches data in it’s repository.

    Your only hope is in one of this 2 tools.

    Unfortunately, git-tf is no more supported since 2 years and do not support branches 🙁

    git-tfs try to do a lot better job but some branch patterns still cause big problems 🙁
    In this last resort case, clone without branch support is your last solution…

    Some doc on how to do it

    Feel free to read more doc on git-tfs github site.

    Access to path ‘x’ denied.

    Are you sure that it is not just some rights access problem? Because I never heard of such a problem…

    Ps: the way Microsoft see the migration from TFVC to git, is to update to tfs 2015 update 2 and to create a git repository into the same project than the existing TFVC project and copy the source code to the git repository. TFVC keeping the history… If needed.

    Git Baby is a git and github fan, let's start git clone.