[英]Merge two TFS branches with git tfs
我正在使用git-tfs
,我想知道是否可以使用git-tfs
合並兩個TFS分支。 我有兩個分支$ / MyCompany / Dev&$ / MyCompany / Release-3.3。 Release-3.3源自Dev分支。 兩者都使用git tfs檢出不同的git存儲庫。
我想將更改重新合並到Dev分支中。 這可以通過git-tfs
實現,還是我不得不嘗試使用TFS工具來實現?
從git-tfs 0.16開始,您可以管理TFS分支(使用branch
命令),因此您現在可以輕松地初始化現有分支,創建一個並合並TFS分支!
從版本0.19開始,您可以對2個TFS分支進行git合並並在TFS中簽入(使用rcheckin),它將作為合並變更集進行檢查: https : //github.com/git-tfs/git- TFS /斑點/主/ DOC /命令/ rcheckin.md#簽-A-合並-變更
唯一的限制(由於TFS)是在與git合並之前已經在TFS中檢查過所有提交並在TFS中檢查它。
因此,您現在可以比使用2TFS分支更容易合並並檢查它們...
我找到了一個很好的,如果hacky這樣做的方式。 Git tfs使用git config管理它對TFS區域的認識。 每個remote
特別有3個屬性 url,repository和fetch,例如:
tfs-remote.default.url=http://tfsserver:8080/tfs/collection
tfs-remote.default.repository=$/Product/Branch/Component
tfs-remote.default.fetch=refs/remotes/default/master
您可以通過使用不同的名稱再次將這3個屬性設置為default
來添加另一個remote
。 例如:
tfs-remote.feature_branch.url=http://tfsserver:8080/tfs/collection
tfs-remote.feature_branch.repository=$/Product/FeatureBranch/Component
tfs-remote.feature_branch.fetch=refs/remotes/default/feature_branch
您可能需要立即發出git tfs bootstrap
。
然后你可以發出:
git tfs fetch -i feature_branch
然后使用以下方法合並提交:
git merge tfs/feature_branch
我不是git-tfs用戶,但我過去用git-svn做過這個(我相信有類似的方法)。 我認為你的主要問題是你有兩個回購。 如果將兩個遠程分支添加到同一個git倉庫,則應該能夠進行本地合並,執行本地提交,然后將該提交推送到TFS。
HTH
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.