git 如何在源树中拉取远程分支

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42073591/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 04:46:37  来源:igfitidea点击:

how to pull remote branch in source tree

gitbitbucketsourcetree

提问by ketchyn

I have repo in bitbucket. it has 2 branches master and Branch9_Artiflex but when I clone this repo to my local repo via source tree (clone-clone in source tree) i'm able to see only master branch.

我在 bitbucket 中有回购。它有 2 个分支 master 和 Branch9_Artiflex,但是当我通过源树(源树中的克隆克隆)将此存储库克隆到本地存储库时,我只能看到主分支。

Create new branch Branch9_Artiflex on my local machine and pull all data from remote Branch9_Artiflex doesn't work because they have differnet history of commits

在我的本地机器上创建新分支 Branch9_Artiflex 并从远程 Branch9_Artiflex 提取所有数据不起作用,因为它们具有不同的提交历史

source treeenter image description here

源树在此处输入图片说明

but my remote repo has 2 branchesenter image description here

但我的远程仓库有 2 个分支在此处输入图片说明

采纳答案by Supun Wijerathne

Try

尝试

  • git fetch. This would fetch any missed remote branch to local repository (assuming there's no other problem).
  • git checkout Branch9_Artiflex. Now you will be switched into a local/Branch9_Artiflex which is newly created with the latest changes of origin/Branch9_Artiflex. :))
  • git fetch. 这会将任何丢失的远程分支提取到本地存储库(假设没有其他问题)。
  • git checkout Branch9_Artiflex. 现在您将被切换到一个 local/Branch9_Artiflex,它是使用 origin/Branch9_Artiflex 的最新更改新创建的。:))

回答by Daniel

You can do this with the gitcli as well as directly in SourceTree UI. Expanding REMOTES> originwas very close: You need to double click on the remote branch there, in your case _Branch9_Artiflex_. Then the following popup appear:

您可以使用gitcli执行此操作,也可以直接在 SourceTree UI 中执行此操作。扩展REMOTES> origin非常接近:您需要双击那里的远程分支,在您的情况下是 _Branch9_Artiflex_。然后出现以下弹窗:

enter image description here

在此处输入图片说明

This would clone the remote branch stagingto a local branch with the same name. Click OK, then SourceTree will fetch the RemoteBranch and it appears on your local branches tree (sidebar left):

这会将远程分支暂存克隆到具有相同名称的本地分支。单击OK,然后 SourceTree 将获取 RemoteBranch 并显示在您的本地分支树上(左侧边栏):

enter image description here

在此处输入图片说明