Posts

Showing posts from September, 2010

Importing a TFS repository into a Git repository using Powershell

Image
Git is a snapshot based system. It takes a snapshot of your entire tree every time you make a commit. The individual changes between commits can be derived from the state of the snapshots.
This simple system makes it easy to recreate an existing Team Foundation Server repository (or any other version control system) into a new Git repository. If you are able to replay the history from a Team Foundation Server repository, you can use this to create a new history in a Git repository.
Enter TFS2GIT.
TFS2GIT is a Powershell script that reads the history of a TFS repository, replays this history in a workspace and finally adds this to a Git repository.
Requirements:
PowershellAccess to the Team Foundation commandline tools (type ‘tf’ in a commandline) Access to msysgit (type ‘git –-version’ in a commandline). To import the history of the repository $/Trunk/ApplicationFoo, use:
.\TFS2GIT.ps1 $/Trunk/ApplicationFoo

Modifying it for your own needsThe script uses a regular expression to filter…