Git to TFS源代码控制迁移

Art*_*rov 16 git version-control tfs tfs-migration

我想看看TFS如何适用于我的命令.所以我想将我们当前的GIT存储库移动到TFS数据库.我们已经使用GIT来获得支持,因此我想使用TFS 2010来解决这个问题.

现在的问题是.如何将GIT仓库导出到TFS.显然这是某种脚本.有没有人这样做过?有什么建议?

谢谢.

Ray*_*yes 11

微软现在已经为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
Run Code Online (Sandbox Code Playgroud)

此外,可以使用预先存在的开源GIT-TFS解决方案(仅限Windows,Microsoft的解决方案使用Java并且是跨平台的),在Git to TFS 2008单向迁移的回答中描述(具有历史记录)


Twi*_*tem 5

我创建了一个快速批处理文件,但您需要在路径和For(命令行循环命令)中使用Team Foundation Power Tools(tfpt.exe)

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
Run Code Online (Sandbox Code Playgroud)
  1. 首先,它以相反的顺序(最早的第一个)创建一个包含所有提交信息的提交文件.
  2. 然后它创建一个Team Foundation工作区......(确保{TtsInstance}用您的TFS URI 替换.
  3. 然后它在工作区中创建一个临时文件夹.
  4. 然后它循环遍历提交文件中的每一行,从git结帐,使用TFPT签入当前文件(再次确保替换{AuthorName}为您的作者姓名)评论将包含来自git的时间戳(遗憾的是你不能更改签入时间而不更改TFS服务器的时间,我建议不要更改)和原作者的姓名.

这工作没问题,但分支机构不会被坚持.我没有花时间弄清楚分支,因为它对当时的工作来说不是一个足够大的因素.

希望这可以节省一些时间!