Git to TFS Source Control Migration

I’d like to see how TFS will work for my command. So I’d like to move our current GIT repository to TFS database. We’ve used GIT for it’s prevailed branching support so I’d like to use TFS 2010 to address that issue.

Now question is. How do I export our GIT repo to TFS. Obviously it’s some kind of script. Does have anyone done that? Any suggestions?

  • git submodule svn external
  • bash completion and git commit --message
  • Embed git commit hash in a .Net dll
  • Get a CVS log/history similar to the “git log” command?
  • Git unable to create file permission denied
  • git error “unable to write sha1 filename … Permission denied”
  • Thank you.

  • Automatic merge of pull requests on Github without the merge bubble
  • Creating branches on an empty project in git
  • Git pushing to non-bare repo, save current worktree
  • Git Fundamentals - Merging back into master
  • Git: what is a graftcommit or a graft-id?
  • How can I diff between my repo and a remote repo that's not origin?
  • 5 Solutions collect form web for “Git to TFS Source Control Migration”

    Microsoft have now released their own GIT <–> TFS extension for GIT: GIT-TF

    This allows pulling a new GIT repository from TFS or configuring to allow GIT to TFS pushes, which is what you want to do:

    (from the documentation)

    For a team working with an existing Git repo, a developer sharing
    changes to TFS using Git-TF would use the following workflow.

    # Configure the existing repo's relationship with TFS
    git tf configure http://myserver:8080/tfs $/TeamProjectA/Main
    # Fetch the latest changes from TFS and merge those 
    # changes with the local changes.
    # Note, merging is important when working in a team configuration. 
    # See "Rebase vs. Merge" below.
    git tf pull
    git commit -a -m "merge commit"
    # Check in the merge commit as a single TFS changeset
    git tf checkin
    # Push the merge commit to the origin
    git push

    In addition, the preexisting open-source GIT-TFS solution can be used (from Windows only, Microsoft’s solution uses Java and is cross-platform), described in an answer to Git to TFS 2008 one way migration (with history)

    I created a quick batch file, but you need to have Team Foundation Power Tools (tfpt.exe) in your path and For (a command line loop command)

    Visual Studio Command line to your desired git folder and run the following.

    git log --pretty="'%%H',%%ci - %%s" --reverse > commits
    tf workspace temp /new /s:http://{TfsInstance} /i
    tf workfold /map %2 . /workspace:temp
    FOR /F "tokens=1* delims=','" %%a IN (commits) DO git checkout %%a && tfpt online /recursive /exclude:.git*,commits,*.obj,*.exe,_ReSharper*,obj,debug,*.user,*.suo,Bin /adds /deletes /i && tf checkin /author:"{AuthorName}" /comment:"%%b" /i
    tf workspace temp /delete /i
    1. First it creates a commits file with all the commit information in reverse order (earliest first).
    2. Then it creates a Team Foundation workspace… (be sure to replace {TtsInstance} with your TFS URI.
    3. Then it creates a temporary folder in the workspace.
    4. Then it loops through each line in the commits file, does a checkout from git, uses TFPT to check in the current files (again be sure to replace {AuthorName} with your author name) the comment will include the timestamp from git (unfortunately you can’t change checkin time without changing the TFS server’s time and I would recommend against that) and the original author’s name.

    This worked okay, but branches won’t be perserved. I didn’t take the time to figure out branching since it wasn’t a big enough factor for the job at the time.

    Hopefully this can save someone some time!

    Set up a SVNBridge to TFS and then use git-svn clone.

    You may be able to export git to svn, and use CS Converter to go from svn to TFVS. Note – CS Converter has been discontinued, but it looks like you can still download it.

    This is an old question, and maybe no one is looking for this anymore, but it is a lot easier now.

    1. Create a Team Project in TFS with Git as the source code control

    2. Grab the Git url for the project. It will look something like …

    3. Drop into the command like and execute.

      git remote add origin

      git push -u origin –all

    Should be all you need.

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