【问题标题】:Git subtree merge on masterGit子树合并在master上
【发布时间】:2015-02-28 12:25:06
【问题描述】:

我在本地和 github(远程)中有两个 repo 分支,即 developmaster。但有一个重大区别。

本地

 master  : identical to last working and stable develop branch
 develop : development branch

远程

 master  : used the following command for this `git subtree push --prefix dist origin master`

 develop : development branch

现在我的同事在他的机器上克隆了 master 分支并更新了一个文件,推送到 remote master 分支。

然后我想,哦,好吧,没关系,我可以这样做:

git subtree pull --prefix dist origin master

由于它与之前的push 命令正好相反,但是它在更新的文件上给了我一个冲突,然后我想,好吧,我将修复并合并冲突然后subtree push 再次,但它给了我:

error: failed to push some refs to 'git@github.com:user/xxx.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

可能是什么问题?有没有正确的方法可以做到这一点。

【问题讨论】:

  • 您能否通过公开的存储库重现该问题?

标签: git github git-merge git-subtree


【解决方案1】:

如果你已经做了一些提交,你可以执行以下操作

git pull --rebase

这会将您所有的本地提交置于新拉取的更改之上。

【讨论】:

    猜你喜欢
    • 2011-04-03
    • 2016-07-03
    • 1970-01-01
    • 1970-01-01
    • 2013-01-14
    • 2016-07-25
    • 1970-01-01
    • 2023-03-28
    • 2013-05-01
    相关资源
    最近更新 更多