简体   繁体   English

Git 从具有指定 URL 的特定分支拉取

[英]Git pull from specific branch with specified URL

I am working on a branch of git.我正在 git 的一个分支上工作。 I want to take pull on this branch specifying the URL alongwith it.我想在这个分支上指定 URL 以及它。 I have tried我试过了

git pull origin <branch> <url>

but it says error "fatal: Invalid refspec "但它说错误“致命:无效的refspec”

Both commands when ran independently works fine.独立运行时,这两个命令都可以正常工作。

1 ) git pull origin <branch> Takes pull from successfully. 1 ) git pull origin <branch>从成功拉取。

2) git pull <url> Takes pull from specified URL but from master branch instead. 2) git pull <url>从指定的 URL 拉取,而是从 master 分支拉取。

I want to take pull from specifying the URL alongwith it so that it doesn't read git's config file and takes pull from 'branch' and 'url'.我想从指定的 URL 中提取,这样它就不会读取 git 的配置文件,而是从 'branch' 和 'url' 中提取。

您需要提供命令git pull web_url branch_name

Add a new remote:添加一个新的遥控器:

git remote add alt <URL>:/path/to/repo

Fetch the content of the repo:获取 repo 的内容:

git remote update

And pull the changes from the branch you want:并从您想要的分支中提取更改:

git pull alt <branch>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM