我想看看 TFS 如何为我的命令工作。所以我想将我们当前的 GIT 存储库移动到 TFS 数据库。我们已经使用 GIT 来支持它流行的分支,所以我想使用 TFS 2010 来解决这个问题。
现在的问题是。如何将我们的 GIT 存储库导出到 TFS。显然这是某种脚本。有没有人这样做过?有什么建议么?
谢谢你。
我想看看 TFS 如何为我的命令工作。所以我想将我们当前的 GIT 存储库移动到 TFS 数据库。我们已经使用 GIT 来支持它流行的分支,所以我想使用 TFS 2010 来解决这个问题。
现在的问题是。如何将我们的 GIT 存储库导出到 TFS。显然这是某种脚本。有没有人这样做过?有什么建议么?
谢谢你。
微软现在已经发布了他们自己的 GIT <--> GIT 的 TFS 扩展:GIT-TF
这允许从 TFS 拉取新的 GIT 存储库或配置为允许 GIT 到 TFS 推送,这是您想要做的:
(来自文档)
对于使用现有 Git 存储库的团队,使用 Git-TF 共享对 TFS 的更改的开发人员将使用以下工作流程。
# Configure the existing repo's relationship with TFS
git tf configure http://myserver:8080/tfs $/TeamProjectA/Main
# Fetch the latest changes from TFS and merge those
# changes with the local changes.
# Note, merging is important when working in a team configuration.
# See "Rebase vs. Merge" below.
git tf pull
git commit -a -m "merge commit"
# Check in the merge commit as a single TFS changeset
git tf checkin
# Push the merge commit to the origin
git push
此外,可以使用预先存在的开源GIT-TFS解决方案(仅从 Windows 开始,微软的解决方案使用 Java 并且是跨平台的),在Git to TFS 2008 one way migration (with history)的回答中有描述
我创建了一个快速批处理文件,但您需要在路径中包含 Team Foundation Power Tools (tfpt.exe) 和 For(命令行循环命令)
将 Visual Studio 命令行添加到所需的 git 文件夹并运行以下命令。
git log --pretty="'%%H',%%ci - %%s" --reverse > commits
tf workspace temp /new /s:http://{TfsInstance} /i
tf workfold /map %2 . /workspace:temp
FOR /F "tokens=1* delims=','" %%a IN (commits) DO git checkout %%a && tfpt online /recursive /exclude:.git*,commits,*.obj,*.exe,_ReSharper*,obj,debug,*.user,*.suo,Bin /adds /deletes /i && tf checkin /author:"{AuthorName}" /comment:"%%b" /i
tf workspace temp /delete /i
{TtsInstance}
为您的 TFS URI。{AuthorName}
用您的作者姓名替换)注释将包括来自 git 的时间戳(不幸的是,您不能更改签入时间而不更改 TFS 服务器的时间,我建议不要这样做)和原作者的姓名。这工作正常,但分支不会被保留。我没有花时间弄清楚分支,因为当时它对于这项工作来说还不够大。
希望这可以节省一些时间!
将SVNBridge设置为 TFS,然后使用 git-svn clone。
您也许可以将 git 导出到 svn,并使用CS Converter从 svn 转到 TFVS。注意 - CS Converter 已停产,但看起来您仍然可以下载它。
这是一个老问题,也许没有人再找这个了,但现在容易多了。
使用 Git 作为源代码控制在 TFS 中创建团队项目
获取项目的 Git url。它看起来像...... https://YOURPROJECTS.visualstudio.com/DefaultCollection/_git/PROJECTNAME
放入命令中并执行。
git 远程添加来源https://YOURPROJECTS.visualstudio.com/DefaultCollection/_git/PROJECTNAME
git push -u origin --all
应该是你所需要的。