使用git tfs合并两个TFS分支

Cei*_*ish 14 git tfs git-tfs

我正在使用git-tfs,我想知道是否可以使用合并两个TFS分支git-tfs.我有两个分支$/MyCompany/Dev&$/MyCompany/Release-3.3.Release-3.3源自Dev分支.两者都使用git tfs检出不同的git存储库.

我想将更改重新合并到Dev分支中.这可以用git-tfs或者我是否必须尝试使用​​TFS工具来实现?

Phi*_*ppe 10

从git-tfs 0.16开始,您可以管理TFS分支(使用branch命令),因此您现在可以轻松地初始化现有分支,创建一个并合并TFS分支!

https://github.com/git-tfs/git-tfs/blob/master/doc/commands/branch.md#initialize-an-existing-tfs-branch

从版本0.19开始,您可以对2个TFS分支进行git合并并在TFS中签入(使用rcheckin),它将作为合并变更集进行检查:https://github.com/git-tfs/git- TFS /斑点/主/ DOC /命令/ rcheckin.md#签-A-合并-变更

唯一的限制(由于TFS)是在与git合并之前已经在TFS中检查过所有提交并在TFS中检查它.

因此,您现在可以比使用2TFS分支更容易合并并检查它们...


Cei*_*ish 6

我找到了一个很好的,如果hacky这样做的方式.Git tfs使用git config管理它对TFS区域的认识.具体为3个属性remote; 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
Run Code Online (Sandbox Code Playgroud)

您可以remote通过使用其他名称再次设置这3个属性来添加另一个属性default.例如:

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
Run Code Online (Sandbox Code Playgroud)

您可能需要立即发布git tfs bootstrap.

然后你可以发出:

git tfs fetch -i feature_branch
Run Code Online (Sandbox Code Playgroud)

然后使用以下方法合并提交:

git merge tfs/feature_branch
Run Code Online (Sandbox Code Playgroud)