Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git-如何在上游分支之外设置远程分支?_Git_Github_Version Control - Fatal编程技术网

git-如何在上游分支之外设置远程分支?

git-如何在上游分支之外设置远程分支?,git,github,version-control,Git,Github,Version Control,用例-我有一个基于github的代码,它有几个分支。 e、 g.开发人员、集成、回归、生产等。 我通常使用此命令添加远程分支:git remote add upstream.git 因此,git remote-v显示如下: upstream <repo link>.git (fetch) upstream <repo link>.git (push) upstream.git(fetch) 上游.git(推送) 但是,如果remote有一个

用例-我有一个基于github的代码,它有几个分支。 e、 g.开发人员、集成、回归、生产等。 我通常使用此命令添加远程分支:
git remote add upstream.git

因此,
git remote-v
显示如下:

upstream        <repo link>.git (fetch)
upstream        <repo link>.git (push)
upstream.git(fetch)
上游.git(推送)

但是,如果remote有一个分支,那么我应该使用什么命令将该分支设置为?

要将新的远程分支设置为本地分支,可以使用
git fetch

之后,您将通过
git branch-a
找到分支


如果要处理新分支,只需使用
git checkout branchname

运行
git fetch
git pull
即可调出包括新分支在内的远程更改

运行
git branch-a
列出所有远程分支

移动或使用获取的远程分支使用

Syntax: git checkout -t remotes/upstream/branchname
Example: git checkout -t remotes/origin/branchname
这里-t将使用上游分支映射创建本地分支。因此,下一个push/pull/fetch操作不会要求您运行
git分支——有时将上游设置为