https://mvc.tw
歡迎參加我們的每週四固定聚會
1
Migrate from TFS to Git
(using Azure DevOps)
Roberson Liou
https://mvc.tw
關於我
▪ 手沖咖啡科技宅
▪ 開發兼維運的偽全端工程師
▪ twMVC核心成員
▪ Blog:工程良田的小球場
2
https://mvc.tw
大綱
3
1 移轉?吃飽沒事x
2 分支策略選用
3 歷史紀錄移轉
4 Azure DevOps With Git
https://mvc.tw
移轉?吃飽沒事x
4
???
???
https://mvc.tw
為什麼要移轉?
▪ 分支成本(空間、時間)
▪ Pull Request
▪ 可離線的開發環境
5
https://mvc.tw
事前準備
▪ 決定使用工具
▪ 挑選分支策略
▪ 訂定歷史記錄移轉方式
▪ 舉辦Traning及Lab
▪ 等待適合時機進行移轉
6
https://mvc.tw
使用工具
7
Visual Studio
▪ 地表最強的開發工具
▪ 整合Azure DevOps
▪ 介面支援多種Git操作
▪ 支援Git/TFVC
▪ 內建看板流程
▪ 整合CI/CD
▪ 自訂測試計畫
Azure DevOps Server
https://mvc.tw
分支策略選用
8
分支策略選用
https://mvc.tw
main
B : 分支, Branch
C : 提交, Commit
M : 合併, Merge
分支策略(TFS) – Release Isolation Flow
release-1.0.0 C
M B
release-1.1.0
CCC
C
bug
B
release-1.0.1
C
bug-fix
https://mvc.tw
分支策略(TFS) – Release Isolation
▪ 優點
▪ 分支策略簡單,學習曲線較低
▪ 開發者僅需專注於main進行開發
▪ Release分支獨立不受干擾
▪ 缺點
▪ 主分支(main)穩定性不足
▪ Release分支成本較高(package restore...)
10
https://mvc.tw
master
B : 分支, Branch
C : 提交, Commit
M : 合併, Merge
分支策略(Git) – Trunk Based Development
11
B
topic-1 C
release-1.0.0
PR
M
topic-1
C C… …
B
C
bug
bug-fix-1 C
B
bug-fix-1
M
cherry-pick
topic-2
B M
PR
topic-2
C C C… …
C
M
PR
release-1.0.1
https://mvc.tw
分支策略(Git) – Trunk Based Development
▪ 優點
▪ 分支週期短,反饋速度較快
▪ 僅需維護一條master分支,減少合併衝突機率
▪ 缺點
▪ 多條分支同時合併回master時,易發生建置資源搶用現象
▪ topic分支容易受master分支影響
12
https://mvc.tw
歷史記錄移轉
13
https://mvc.tw
歷史紀錄該移轉嗎?
▪ TFS與Git先天不同
▪ 分支方式
▪ 檔案變更記錄儲存方式
▪ 「我們建議您不要移轉歷史記錄,而是只將最新的分支版本移轉至
Git。」 – Matt Cooper, Program Manager, Azure DevOps
▪ 持續維護舊版控系統(TFS)
▪ 於新版控系統的專案描述中放上舊版控的連結
14
https://mvc.tw
Azure DevOps內建移轉方式
▪ 僅支援Azure DevOps|TFS 2018|TFS 2017
▪ 兩個專案必須在同一個組織下
▪ 最多只能移轉180天的歷史記錄
▪ 專案大小不能超過1GB
15
https://mvc.tw
git-tfs
▪ Open Source
▪ 提供git、tfs雙向移轉
▪ 指令式操作
▪ git tfs clone http://tfs:8080/tfs/DefaultCollection $/some_project
▪ 移轉速度較慢
▪ 參考文章:TFVC - Git 專案搬家經驗談(黑暗執行緒)
16
https://mvc.tw
Training & Lab
17
https://mvc.tw
Training
18
master B
Joe/test C
merge
M
Joe/test
C
file-Joe
Lab
Azure DevOps
https://mvc.tw
TFS & Git 指令比較
19
TFS Git
簽入(local) X commit
簽入(remote) Check In push
簽出 Get Latest Version pull = fetch + merge
對照本機路徑 Map Local Path clone
拆掉local commit X reset --hard
暫存程式碼 Shelveset stash
https://mvc.tw
20
Azure DevOps with Git
https://mvc.tw
Branch Policy(1)
▪ 強迫該分支只接受PR
▪ 套用後該分支無法刪除
▪ 設定最低通過的Reviewer人數
21
https://mvc.tw
Branch Policy(2)
▪ 檢查是否有工作項目連結
▪ 確認每個回覆是否有解決
▪ 限制合併方式
22
https://mvc.tw
Branch Policy(3)
▪ 驗證建置及測試是否通過
▪ 須先建立CI Pipeline
▪ 設定預設Reviewer名單
▪ 可指定群組
23
https://mvc.tw
Pull Request
▪ 協助程式碼審查流程
▪ 可加入自訂標籤
▪ 在PR完成時...
▪ 可挑選合併方式
▪ 可在合併後刪除分支
▪ 可自動完成連結的工作項目
24
https://mvc.tw
Pull Request Template
▪ 可引導Requestor描述情境
▪ 套用方式分為3種
▪ Default
▪ Branch Specific
▪ Addtional
▪ 命名參考(MSDN)
25
Default
Additional
Branch
Specific
https://mvc.tw
程式還沒寫完但想找人Review?
▪ 走一般PR機制可能會不小心被合併
▪ 標題開頭加上「WIP」、「Do-not-Merge」
▪ Draft Pull Request
▪ 不會觸發Build Validation
▪ 預設的Reviewer不會被加入
▪ 當功能完成後可直接切換為Publish模式
26
https://mvc.tw
如果你想學Git...
27
https://mvc.tw
推薦閱讀 – Git & Branch Strategies
▪ Git Turtorials(Bitbucket)
▪ Branch Strategies for TFS(MSDN)
▪ Trunk Based Introduction
▪ How We Use Git At Microsoft(MSDN)
28
https://mvc.tw
推薦閱讀 – How to Migrate
▪ 從集中版本控制到分散式版本控制(王建興)
▪ TFS Git 筆記 - 該用 TFVC 還是 Git?(黑暗執行緒)
▪ TFS Git 筆記 - TFVC - Git 專案搬家經驗談(黑暗執行緒)
▪ Map TFVC actions to Git(MSDN)
▪ Plan your migration to Git(MSDN)
29
Blog 是記錄知識的最佳平台
30
https://dotblogs.com.tw
31
SkillTree 為了確保內容與實務不會脫節,我們都是聘請企業顧問等級
並且目前依然在職場的業界講師,我們不把時間浪費在述說歷史與沿革,
我們並不是教您考取證照,而是教您如何上場殺敵,拳拳到肉的內容才
是您花錢想要聽到的,而這也剛好是我們擅長的。
https://skilltree.my
32
天瓏資訊圖書

More Related Content

PPTX
twMVC#41 The journey of source generator
PDF
twMVC#42 讓我們用一種方式來開發吧
PDF
twMVC#43 Visual Studio 2022 新功能拆解
PDF
twMVC#42 Windows容器導入由0到1
PDF
twMVC#42 Azure IoT Hub for Smart Factory
PDF
twMVC#44 讓我們用 k6 來進行壓測吧
PDF
twMVC#43 YARP
PPTX
twMVC#31網站上線了然後呢
twMVC#41 The journey of source generator
twMVC#42 讓我們用一種方式來開發吧
twMVC#43 Visual Studio 2022 新功能拆解
twMVC#42 Windows容器導入由0到1
twMVC#42 Azure IoT Hub for Smart Factory
twMVC#44 讓我們用 k6 來進行壓測吧
twMVC#43 YARP
twMVC#31網站上線了然後呢

What's hot (20)

PDF
twMVC#32應用 ASP.NET WebAPI2 Odata 建置高互動性 APIS
PDF
twMVC#30 | 你應該瞭解的 container-on-azure-二三事
PDF
twMVC#33玩轉 Azure 彈性部署
PPTX
twMVC#31沒有 hdd 的網站重構 webform to mvc
PDF
twMVC#36讓 Exceptionless 存管你的 Log
PDF
twMVC#33聊聊如何自建 Facebook {廣告} 服務 with API
PDF
Asp.net mvc 從無到有 -twMVC#2
PDF
twMVC#41 hololens2 MR
PDF
twMVC#42 Azure DevOps Service Pipeline設計與非正常應用
PDF
twMVC#36.NetCore 3快速看一波
PDF
twMVC#26 | 淺談 ASP.NET Caching 技術與實踐
PDF
twMVC#43 C#10 新功能介紹
PDF
twMVC#26 | Redis資料型別與場景的連結
PDF
twMVC#19 | opserver監控服務的解決
PDF
Node.js從無到有 基本課程
PDF
twMVC#23 | 快速上手 Azure Functions
PPTX
SQL Server 資料庫版本控管
PDF
twMVC#21 | 以實例說明ASP.NET Web API 服務的開發與測試過程
PDF
twMVC#21 | 你所不知道的 Visual Studio
PDF
NodeJS基礎教學&簡介
twMVC#32應用 ASP.NET WebAPI2 Odata 建置高互動性 APIS
twMVC#30 | 你應該瞭解的 container-on-azure-二三事
twMVC#33玩轉 Azure 彈性部署
twMVC#31沒有 hdd 的網站重構 webform to mvc
twMVC#36讓 Exceptionless 存管你的 Log
twMVC#33聊聊如何自建 Facebook {廣告} 服務 with API
Asp.net mvc 從無到有 -twMVC#2
twMVC#41 hololens2 MR
twMVC#42 Azure DevOps Service Pipeline設計與非正常應用
twMVC#36.NetCore 3快速看一波
twMVC#26 | 淺談 ASP.NET Caching 技術與實踐
twMVC#43 C#10 新功能介紹
twMVC#26 | Redis資料型別與場景的連結
twMVC#19 | opserver監控服務的解決
Node.js從無到有 基本課程
twMVC#23 | 快速上手 Azure Functions
SQL Server 資料庫版本控管
twMVC#21 | 以實例說明ASP.NET Web API 服務的開發與測試過程
twMVC#21 | 你所不知道的 Visual Studio
NodeJS基礎教學&簡介

Similar to twMVC#38 How we migrate tfs to git(using azure dev ops) (20)

PPTX
How we migrate TFS to Git ( using Azure DevOps )
PDF
Git 經驗分享
PDF
如何與 Git 優雅地在樹上唱歌
PDF
Introduction to git
PDF
Git in a nutshell
PPT
Version control0221
PPTX
大家應該都要會的工具 Git 從放棄到會用2-分支篇
PPTX
GIT實務操作與理論
PPTX
git merge 與 rebase 的觀念與實務應用
PPTX
Git基礎介紹
PPTX
[2020 .NET Conf] 企業Azure DevOps Service 實際應用架構與秘辛
ODP
Git 教學
PDF
前端的未來 - 前端工程實務訓練
PDF
Git Flow基礎操作與觀念介紹
PDF
Intro to Git 投影片
PDF
Git 版本控制系統 -- 從微觀到宏觀
PPTX
Git introduction
PPTX
Git & git flow
PDF
Git and Github basic with SourceTree
PPTX
Git & git hub v1.2
How we migrate TFS to Git ( using Azure DevOps )
Git 經驗分享
如何與 Git 優雅地在樹上唱歌
Introduction to git
Git in a nutshell
Version control0221
大家應該都要會的工具 Git 從放棄到會用2-分支篇
GIT實務操作與理論
git merge 與 rebase 的觀念與實務應用
Git基礎介紹
[2020 .NET Conf] 企業Azure DevOps Service 實際應用架構與秘辛
Git 教學
前端的未來 - 前端工程實務訓練
Git Flow基礎操作與觀念介紹
Intro to Git 投影片
Git 版本控制系統 -- 從微觀到宏觀
Git introduction
Git & git flow
Git and Github basic with SourceTree
Git & git hub v1.2

More from twMVC (12)

PDF
twMVC#51 以平台工程重新思考系統設計 - 以 Batch System 為例封面
PDF
twMVC#51-GitHub Copilot 徹底改變開發模式,探索 AI 驅動的智慧程式碼協作
PDF
twMVC#50 微服務上線後的救贖
PDF
twMVC 47_Elastic APM 的兩三事
PDF
twMVC#46_SQL Server 資料分析大躍進 Machine Learning Services
PDF
.NET 7 家族新成員: Microsoft Orleans v7
PDF
twMVC#46 一探 C# 11 與 .NET 7 的神奇
PDF
twMVC#44 如何測試與保護你的 web application with playwright
PDF
twMVC#36C#的美麗與哀愁
PDF
twMVC#30 | Bootstrap 搶先玩
PDF
twMvc#30 | 技術人員與業務團隊的無礙的溝通法則
PDF
twMVC#29 | 當.Net Core 遇到AWS Lambda
twMVC#51 以平台工程重新思考系統設計 - 以 Batch System 為例封面
twMVC#51-GitHub Copilot 徹底改變開發模式,探索 AI 驅動的智慧程式碼協作
twMVC#50 微服務上線後的救贖
twMVC 47_Elastic APM 的兩三事
twMVC#46_SQL Server 資料分析大躍進 Machine Learning Services
.NET 7 家族新成員: Microsoft Orleans v7
twMVC#46 一探 C# 11 與 .NET 7 的神奇
twMVC#44 如何測試與保護你的 web application with playwright
twMVC#36C#的美麗與哀愁
twMVC#30 | Bootstrap 搶先玩
twMvc#30 | 技術人員與業務團隊的無礙的溝通法則
twMVC#29 | 當.Net Core 遇到AWS Lambda

twMVC#38 How we migrate tfs to git(using azure dev ops)