相关疑难解决方法(0)

为pull提供非默认远程的默认分支

我将远程原点设置为当前分支的默认分支.我还有一个上游遥控器,它不是分支的默认值.有没有办法在远程配置默认分支,所以当我拉它默认为该分支?

这是我的.git/config:

[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git@github.com:studgeek/knockout.git
[branch "gh-pages"]
        remote = origin
        merge = refs/heads/gh-pages
[remote "upstream"]
        url = git://github.com/SteveSanderson/knockout.git
        fetch = +refs/heads/*:refs/remotes/upstream/*
        merge = refs/heads/gh-pages
Run Code Online (Sandbox Code Playgroud)

有了这个我可以愉快地做以下,它默认为 origin/gh-pages

git pull
Run Code Online (Sandbox Code Playgroud)

我想做的就是给它远程上游并让它弄清楚分支(gh-pages)部分

git pull upstream
Run Code Online (Sandbox Code Playgroud)

而不是这个

git pull upstream gh-pages
Run Code Online (Sandbox Code Playgroud)

如果我省略分支,我现在得到以下内容:

$ git pull upstream
You asked to pull from the remote 'upstream', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the …
Run Code Online (Sandbox Code Playgroud)

git github

5
推荐指数
1
解决办法
5056
查看次数

标签 统计

git ×1

github ×1