Recently our company passed to GIT.
My personal projects were stored on Visual Studio Online. All projects were created with Team Foundation Server (Default on visual studio online) source control but VS gives a possibility to create projects for GIT as well. To keep more visual project evaluation (branches, tags, commits etc.) which is not really possible on TFS I have moved TFS projects to GIT under VS Online. In this way my personal and professional projects will be managed in one place (SourceTree) and in one single way.
To migrate your project here are some useful steps how to do this (original article can be found here):
Install Chocolatey to be able to download git-tfs pacakge. This project gives a better and easiest way to do that. To install this project:
- Run CMD as administrator.
- Execute following command:
You can also start this directly from PowerShel using following command:
This will install project to your user folder: C:\Users\<YourUser>\chocolatey
Once this is installed you can download and install git-tfs package. Run following command to do this:
This will install package git-tfs to C:\tools\gittfs folder. Navigate to this folder in CMD.
- Find URL of VS Online default collection. Assuming your TFS server is https://tfs.contoso.com. Default collection will be https://tfs.contoso.com/tfs/DefaultCollection.
- List all available branches that can be cloned by using following command:
Note default branch of the project which is marked by [*]. This should be similar to /Project/BranchPath.
Now you can clone this TFS project to you local GIT repo:
- $/Project/Branch – Default project’s master branch path which you have found when listed all branches.
- [Directory path] is a path where you local REPO will be stored.
In this step we will recreate new project on VS Online based on GIT source control instead of TFS. To do this:
- Navigate to you VS Online account.
- Go to setting by clicking on settings icon (Figure 1).
- Go to default collection to list all your projects (Figure 2)
- In context menu of the project select “Delete” (Figure 3)
- Read and confirm delete (Figure 4)
- Wait while removed (Figure 5)
- Now project is removed (Figure 6)
- Now create new project (out of scope in this artcle)
- Navigate to “Code” tab in VSO and note URL to clone.
- Navigate in CMD to your local repo and execute following command:
This will set the origin (the remote repository address) to point to our git repository in VSO.
Now we just need to push changes to VSO by using following command:
When you have several branches:
- Do same above push command by specifying the branch to which to push instead of “master”.