试图合并分支,然后尝试重新设置基础-仍然不能强制master与dev分支相同 [英] Tried to merge branches, then tried to rebase - still can't force master to be identical to dev branch

查看:125
本文介绍了试图合并分支,然后尝试重新设置基础-仍然不能强制master与dev分支相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试将dev分支合并到master分支,但这是我的第一次,我认为我完全误解了术语.

I've been trying to merge my dev branch into the master branch but as this is my first time, I think I've completely misunderstood the terminology.

首先,我尝试了合并:

我试图将开发人员合并到无效的master中.解决冲突时,我使用我们的"想法,这意味着将我的"开发分支合并到主服务器中,但是当事情发生变化时,该站点看起来与开发分支结帐时的外观不同.

I tried to merge dev into master which didn't work. When resolving conflicts, I used "ours" thinking this meant merging "my" dev branch into the master but while things changed, the site didn't look the same as it did when the dev branch was checkout.

然后我尝试重新设置基准:

然后,我相当鲁ck地尝试了一个重新设置,认为这将迫使master分支与dev分支相同,但又一次,可能使用了错误的选项来解决冲突,因为该站点看起来与初始合并后的站点相同.

I then rather recklessly tried a rebase thinking this would force the master branch to be identical to the dev branch but again, possible used the wrong options to resolve the conflicts as the site looks the same as it did after the initial merge.

在这一点上,我可以强制将master分支与dev分支相同吗?

如果我切换回dev分支,则站点看起来正确-如何将更改合并到master分支中,以便使站点看起来与检出dev分支时的站点相同?

If I switch back to the dev branch the site looks correct - how do you merge the changes into the master branch so the site looks the same as when the dev branch is checked out?

或者在这一点上,是否有一种方法可以强制master与dev相同?

Or at this point, is there a way just to force master to be the same as dev?

对不起,如果这很容易,我会发现git中的术语令人困惑,并且似乎不理解我所阅读的答案/教程-任何帮助将不胜感激.

Sorry if this is easy, I find the terminology in git confusing and seemingly didn't understand the answers/tutorials I've read - any help would be much appreciated.

顺便说一句,我正在使用Mac Git客户端Tower.

BTW, I'm using the Mac Git client, Tower.

欢呼

推荐答案

如果要强制主服务器与开发人员相同",则始终有效的过程是:

If you want to "force the master to be the same as the dev", the procedure which will always work is to:

  • 删除主分支(git checkout dev; git branch -D master)
  • 从dev(git branch master; git checkout master)重新创建master分支
  • Delete the master branch (git checkout dev; git branch -D master)
  • Recreate the master branch from dev (git branch master; git checkout master)

...现在,两个分支是相同的(相同的HEAD并因此具有相同的历史记录).

... Now the two branches are identical (same HEAD and thus same history).

您的问题很可能是合并合并后您没有重置.从理论上讲,重新建立基础(具有共同的祖先)或合并将产生一个分支,该分支将两个分支的更改集成在一起.如果合并没有按照您的期望进行,请重置回之前的位置,然后重试.对结果满意之前不要提交结果!

Your problem is likely that you didn't reset after your botched merge. In theory, either a rebase (with a common ancestor) or a merge will produce a branch which integrates changes from both branches. If the merge doesn't go as you hoped, reset back to before it and try again. Don't commit the result until you're happy with it!

这篇关于试图合并分支,然后尝试重新设置基础-仍然不能强制master与dev分支相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆