Skip to content

Instantly share code, notes, and snippets.

@andrewabest
Last active November 22, 2015 23:59
Show Gist options
  • Save andrewabest/3cec183d11aa1efe09da to your computer and use it in GitHub Desktop.
Save andrewabest/3cec183d11aa1efe09da to your computer and use it in GitHub Desktop.
Git-Tfs Setup

First

Then

To clone the main branch of your TFS project as a git repo (aka get the codez):

  • Create a new directory to store your git projects, seperate from your 'standard' TFS source directory**. (For example, use c:\projects.git instead of c:\projects)
  • Open a command prompt and navigate to your git source directory.
  • mkdir MyAwesomeProject, cd MyAwesomeProject
  • git tfs clone http://tfsserver:8080/tfs/projects%20collection "$/My Awesome Project/Branch" . --with-branches

Welcome to git!

Gotchas

  • if your project collection name contains spaces, MAKE SURE YOU ESCAPE IT (as above)! This same caveat does not apply to the branch name.
  • you need to make sure the thing you're trying to clone IS A BRANCH, and not just a folder. To turn a folder into a branch in TFS, locate it in Source Control Explorer, right click it, Branching and Merging > Convert to Branch. Done.
  • ** If git-tfs encounters any conflicts with existing TFS workspace mappings, it will get upset.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment