- Install Git. See: Install Git
- Install Github CLI. See: Installing Github CLI
- Install Git-Tfs. See: Get git-tfs
- You need at least .NET 4.6.2 and the 2012 or 2013 version of Team Explorer installed (or Visual Studio) depending on the version of TFS you want to target.
- Clone this repo and initialize the submodules
git clone https://github.com/martins-vds/tfvc-git-migration-scripts.git
git submodule update --init
- If this repo is already cloned locally, pull the latest changes:
git pull --recurse-submodules
- Initialize the local git repo which will be the target of the TFVC migration. Example:
.\Init-LocalRepo.ps1 -GitRepoDirectory "c:\path\to\local\git\folder" -TfsUrl "https://contoso.com/tfs/defaultcollection" -TfsRepoPath "$/Contoso/Trunk" -IgnoreFile "c:\path\to\gitignore"
- Initialize the Github repo which will host the migrated code. Example
.\Init-GithubRepo.ps1 -GitRepoDirectory "c:\path\to\local\git\folder" -Token "authTokenGoesHere" -Name "NameOfRepoGoesHere" -Description "DescriptionOfRepoGoesHere" -Team "TeamAssignedToRepo" -Organization "OrgNameGoesHere"
- The "Team" argument is optional
To generate an auth token, see Creating a personal access token The auth token requires the 2 scopes: "repo" and "read:org" (under "admin:org")
- Pull from TFS. Example:
.\Pull-Tfs.ps1 -Changeset 1234 -IgnoreFile "c:\path\to\gitignore" -GitRepoDirectory "c:\path\to\local\git\folder"
- Initialize GitVersion. Example:
.\Init-GitVersion.ps1 -GitRepoDirectory "c:\path\to\local\git\folder"
⚠️ ⚠️ ⚠️ MAKE SURE THAT THE CODE BUILDS CORRECTLY COMMIT EVERY CHANGE BEFORE MOVING ON TO THE NEXT STEP⚠️ ⚠️ ⚠️
- Set Next Version. Example:
.\Set-NextVersion.ps1 -NextVersion 1.0.0 -GitRepoDirectory "c:\path\to\local\git\folder"
- Initialize Git Flow. Example:
.\Init-GitFlow.ps1 -GitRepoDirectory "c:\path\to\local\git\folder"
- Push the local git repo to Github. Example:
.\Push-Github.ps1 -GitRepoDirectory "c:\path\to\local\git\folder"
- Cleanup TFS related configs. Example:
.\Cleanup-TfsConfigs.ps1 -GitRepoDirectory "c:\path\to\local\git\folder"