git-如何在上游分支之外设置远程分支?
用例-我有一个基于github的代码,它有几个分支。 e、 g.开发人员、集成、回归、生产等。 我通常使用此命令添加远程分支: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有一个
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分支——有时将上游设置为