准备工具:
- https://github.com/git-tfs/git-tfs 
具体的安装步骤上面的 readme.md 中有说明。通过 Chocolatey 安装,如果本地没有 git ,会自动安装 git 到本地。
迁移步骤:
- 从 Visual Studio 里面进入 Source Control Explorer,从左侧选择要迁移的项目,然后点击鼠标右键选择 Branching and Merging 再选择 Convert to Branch...,弹出对话框,选择是。(注:这一步很重要,没有这一步,将无法完成接下来的迁移操作) 
- 打开 git-bash,通过命令:git tfs list-remote-branches http://tfs:8080/tfs/your_collection_name/ 可以查看到有哪些分支(类似 git branch 命令)。(注:会提示用户输入TFS 的用户名和密码) 
- 使用命令迁移源代码:MSYS_NO_PATHCONV=1 git tfs clone http://tfs:8080/tfs/your_collection_name/ "$/your_collection_name/your_branch_name" -d (注:会再次提示输入 TFS 的用户名和密码,不会记忆) 
- 用文本编辑器(如:Notepad++)打开 sln 文件,移除 GlobalSection(TeamFoundationVersionControl) 这一节。 
- 迁移完成。 
示例:
MSYS_NO_PATHCONV=1 git tfs clone http://tfs:8080/tfs/DefaultCollection $/your_project_branch
$/your_project_branch 表示的是TFS上面项目的位置,可以使用英文 "" (引号)括起来,也可以不要
上面的示例 $ 前面要有个空格
原文地址:http://www.cnblogs.com/jRoger/p/7388575.html
.NET社区新闻,深度好文,微信中搜索dotNET跨平台或扫描二维码关注
