[英]How to update current branch with changes from master using TFS?
I have a project code that uses Team Foundation Server (TFS) for revision control.我有一个使用 Team Foundation Server (TFS) 进行修订控制的项目代码。 I created a new branch named
br-feature
from main
using Visual Studio 2019. Since then, my main
branch changed.我使用 Visual Studio 2019 从
main
创建了一个名为br-feature
的新分支。从那时起,我的main
分支发生了变化。 I want to pull all the new changes from the main
branch and onto the current br-feature
branch to ensure everything works before I merge changes from br-feature
into main
.我想将所有新更改从
main
分支拉到当前的br-feature
分支,以确保在我将更改从br-feature
合并到main
之前一切正常。
I do not see an option using Visual Studio to fast-forward current branch.我没有看到使用 Visual Studio 快进当前分支的选项。 How can I pull all the changes from my
main
branch into br-feature
using TFS?如何使用 TFS 将
main
分支中的所有更改拉入br-feature
?
From the comments the repo is TFVC.从评论来看,repo 是 TFVC。 TFS can host TFVC and git repos.
TFS 可以托管 TFVC 和 git 存储库。
To work with TFVC:使用 TFVC:
In TFVC branches are hierarchal.在 TFVC 中,分支是分层的。 The question description suggests that
br-feature
is a child branch of main
.问题描述表明
br-feature
是main
的子分支。 It should be straight-forward to merge from main
(the parent branch) to br-feature
(a child branch).从
main
(父分支)合并到br-feature
(子分支)应该是直截了当的。
TFVC is file-based, not snapshot-based like git. Each file has its own chain of deltas. TFVC 是基于文件的,而不是像 git 那样基于快照的。每个文件都有自己的增量链。 TFVC changesets are equivalent to git commits but are a set of deltas to files.
TFVC 变更集相当于 git 次提交,但它是文件的一组增量。
Because TFVC is file-based, file adds and file deletes are somewhat special.因为 TFVC 是基于文件的,所以文件添加和文件删除有些特殊。 To keep the order of changesets correct, always merge parent to child before child to parent.
为了保持变更集的顺序正确,请始终先将父项合并到子项,然后再将子项合并到父项。 ie ensure that changes in
main
are merged to br-feature
and br-feature
is up to date with main
before merging br-feature
to main
.即确保
main
中的更改合并到br-feature
并且br-feature
在将br-feature
合并到main
之前与main
保持同步。 The 'order' is important with how file adds and deletes are interpreted. “顺序”对于文件添加和删除的解释方式很重要。
With the branch hierarchy the auto-merge logic is able to perform a three-way compare: the current 'target' file, the incoming changed 'source' file, and the common ancestor for both.通过分支层次结构,自动合并逻辑能够执行三向比较:当前“目标”文件、传入的已更改“源”文件以及两者的共同祖先。 But the branch hierarchy can be very limiting.
但是分支层次结构可能非常有限。
When you choose 'Merge...` from the context menu, the 'Merge' dialog will open.当您从上下文菜单中选择“合并...”时,“合并”对话框将打开。 The branch you clicked on will be selected as the source branch and you will be able to select the target branch.
您单击的分支将被选择为源分支,您将能够 select 目标分支。 (The merge is from 'source' to 'target'.)
(合并是从“源”到“目标”。)
The "All changes up to a specific version" option is what you want to use.您要使用的是“特定版本的所有更改”选项。 It will default to
T
which is the most recent revision (somewhat like HEAD
with git).它将默认为
T
,这是最新的修订版(有点像带有 git 的HEAD
)。
(In the 'Merge' dialog you will see language about a 'merge relationship' - that means there is a parent/child relationship between the branches. You will also see mention of a 'baseless merge' - that means there is no parent/child relationship. The auto-merge logic doesn't support baseless merges. If you do a baseless merge all changes need to be manually merged.) (在“合并”对话框中,您会看到有关“合并关系”的语言 - 这意味着分支之间存在父/子关系。您还会看到提及“无基础合并” - 这意味着没有父/子关系。自动合并逻辑不支持无基础合并。如果您执行无基础合并,则所有更改都需要手动合并。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.