[英]VSTS git: How to get the “branch” from the remote repository?
In TFS: We had a "master" branch called main. 在TFS中:我们有一个名为main的“ master”分支。 When we worked on features, we would branch the "master" into a "feature-branch".
当我们处理要素时,我们会将“母版”分支为“要素分支”。 TFS would physically make a "copy" of the "master" branch in the working folder for the "feature-branch" that we can work on.
TFS会为我们可以处理的“功能分支”在工作文件夹中物理地复制“主”分支。
How does it work in VSTS git? 它在VSTS git中如何工作? I created a branch of the "master" called "feature-branch".
我创建了“主”的一个分支,称为“功能分支”。 I pulled the latest from the repository.
我从存储库中提取了最新的。 How do I switch to the "feature-branch" from the "master" so I can work on the features?
如何从“母版”切换到“功能分支”,以便可以使用这些功能? Is it as easy as just clicking "Branches" in the VSTS menu and then click the "feature-branch" in the "remote/origin" folder?
它像单击VSTS菜单中的“分支”,然后单击“远程/原始”文件夹中的“功能分支”一样简单吗?
If your origin is already set up, you just check it out. 如果您的原点已经建立,则只需将其签出即可。
git checkout feature-branch
To see all your branches 看你所有的分店
git branch -a
This will list them for you. 这将为您列出它们。 If you don't see your remote branch listed, then perform a fetch to get a new list of branches and tags from your remote
如果未列出远程分支,请执行获取操作以获取远程分支的新列表和标签
git fetch
If you want to create feature-branch locally, then you can do that, too. 如果要在本地创建功能分支,那么也可以这样做。 This is my normal workflow.
这是我正常的工作流程。 To do this, you create the local branch, check it out and then you can push it to your remote.
为此,您可以创建本地分支,将其检出,然后将其推送到您的遥控器。 Like this:
像这样:
git checkout -b feature-branch
git push -u origin feature-branch
The first line created and branch and checks it out in one hit. 第一行创建并分支,并在一个命中中将其签出。 The second line pushed your new branch to the remote (named origin).
第二行将您的新分支推送到远程服务器(命名为origin)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.