【问题标题】:Make not-master-branch to pull from master branch使非主分支从主分支中提取
【发布时间】:2012-01-25 15:29:19
【问题描述】:

当我从非主分支git pull 时,我得到以下响应。

你让我拉,但没有告诉我你想合并哪个分支 配置文件中的'branch.not_master.merge' 也不告诉我。请指定您要在哪个分支上使用 命令行并重试(例如'git pull ')。

我要配置的是让这个分支接受来自主分支的拉取,以及它的远程分支。

有可能吗?

例如

//on a branch A that is not master.
git pull master //pull from remote HEAD and merge without warning
git pull        //pull from A and merge

【问题讨论】:

标签: git


【解决方案1】:

从远程仓库拉取时应该使用 git pull。您需要指定远程资源,例如:

git pull origin master

git merge 可以只取本地分支名称,不需要远程资源:

git 合并大师

【讨论】:

    【解决方案2】:

    就像消息说的那样,将branch.not_master.merge 设置为refs/heads/not_master,这样当您执行git pull 时,它将从远程的同一个分支中提取(还要确保将branch.not_master.remote 设置为远程,例如@ 987654325@)

    要拉入其他分支,您必须将其写为git pull origin master,因为在这种情况下您不能省略远程。

    【讨论】:

    • 我不小心做到了。 git config branch.not_master.merge to refs/heads/master 这是什么意思?看来我无法从 not_master 分支提交,因为它被 [rejected] 和(非快进).... 我认为我犯了一个大错误
    猜你喜欢
    • 2015-09-28
    • 2014-09-19
    • 2020-04-12
    • 2011-06-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-06
    • 2021-01-22
    相关资源
    最近更新 更多