[英]Getting merge commit while merging master to my own branch
I am trying to merge master to my feature branch derived from master. 我正在尝试将master合并到派生自master的功能分支中。 Master branch is already ahead by N commits. Master分支已经提前N次提交。 so to merge i gave following commands after checking out my branch B1 所以要合并,我在签出我的分支B1后给出了以下命令
1) git pull
2) git merge master
Both worked well, but now when i gave command: 两者都运行良好,但是现在当我发出命令时:
git push origin B1
i was getting error: 我收到错误消息:
Found Merge commit in refs/heads/B1, not pushing error: failed to push some refs to git@git.corp.company.com:ProjectName/bullseye.git 在refs / heads / B1中发现合并提交,未推送错误:无法将某些引用推送到git@git.corp.company.com:ProjectName / bullseye.git
Any idea how to merge master to my branch remotely. 任何想法如何将master远程合并到我的分支。
use git pull origin --rebase master
instead. 使用git pull origin --rebase master
代替。
But use git reflog
to see where your branch was before you did git pull
. 但是,在执行git pull
之前,请使用git reflog
查看分支的位置。 After you find the sha-1, git reset sha-1 --hard
and then run the --rebase pull. 找到sha-1之后, git reset sha-1 --hard
,然后运行--rebase pull。
Judging from the error message your remote seems to dislike merges in non- master
branches. 从错误消息来看,您的遥控器似乎不喜欢非master
分支中的合并。 What you should do then is rebase onto master
instead. 然后,您应该做的是将基础改master
。
git checkout B1
git fetch origin
git rebase origin/master
Usually, rebase
should also undo all merges you already did. 通常, rebase
还应该撤消您已经完成的所有合并。 In case it doesn't you can undo the rebase 如果没有,您可以撤消变基
git reset --hard <sha1 of B1 before rebase>
and then find the commit right before the merge and reset to it: 然后在合并之前找到提交并重置为:
git log
git reset --hard <sha1 of commit before merge>
afterwards you can rebase
again. 之后,您可以重新设置rebase
。 Also git reflog
is handy to keep an overview of the different states you go through while merging and rebasing. git reflog
还可方便地概述合并和重新定基时所经历的不同状态。
What you cannot do is "merge branches remotely". 您不能做的是“远程合并分支”。 Git does not allow that. Git不允许这样做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.