Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.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 如何通过url获取特定的分支?吉特_Git - Fatal编程技术网

Git 如何通过url获取特定的分支?吉特

Git 如何通过url获取特定的分支?吉特,git,Git,在我的服务器中,我编写了一个bash脚本,从我的Github repo获取最后的更改。 我拉取最新的master分支,url如下: git pull myuser:mypassword@github.com/myrepo.git 现在我想在这个bash脚本中获得一个特定的分支?不是克隆,我想拉一个特定的分支。是否可以使用URL执行此操作?将命令格式总结为: git pull [<options>] [<repository> [<refspec>…​]] 更

在我的服务器中,我编写了一个bash脚本,从我的Github repo获取最后的更改。 我拉取最新的
master
分支,url如下:
git pull myuser:mypassword@github.com/myrepo.git

现在我想在这个bash脚本中获得一个特定的分支?不是
克隆
,我想
一个特定的分支。是否可以使用URL执行此操作?

将命令格式总结为:

git pull [<options>] [<repository> [<refspec>…​]]
更常见的情况是,您会设置一个“remote”,它只是该存储库URL的别名:

# set up once
git remote add some-memorable-name myuser:mypassword@github.com/myrepo.git
# use from then on
git pull some-memorable-name some-branch-name
这就是为什么您会在网上看到大量命令示例,如
git pull upstream master
-
upstream
指某个特定的远程存储库,而
master
是获取和合并的分支。

将命令格式总结为:

git pull [<options>] [<repository> [<refspec>…​]]
更常见的情况是,您会设置一个“remote”,它只是该存储库URL的别名:

# set up once
git remote add some-memorable-name myuser:mypassword@github.com/myrepo.git
# use from then on
git pull some-memorable-name some-branch-name

这就是为什么您会在网上看到大量命令示例,如
git pull upstream master
-
upstream
指的是某个特定的远程存储库,
master
是获取和合并的分支。

这是否回答了您的问题?这回答了你的问题吗?