如何在git中使用override选项将分支合并到另一个分支中 [英] How to merge a branch into another with override option in git

查看:227
本文介绍了如何在git中使用override选项将分支合并到另一个分支中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用git,我有两个分支:生产和主人。这时生产已经9个月了,很多变化都进入了master分支。



我正在使用capistrano,所以我需要将所有更改推送到生产分支这样我才能部署。但是当我合并时,我会遇到大量的合并冲突。我不关心合并问题,因为我希望我的生产分支被主分支覆盖。有没有办法做到这一点。



如果不是,我正在考虑创建一个名为production_old的生产分支。然后删除生产分支中的所有内容,然后从主合并。



我正在使用github。 可能我们的合并策略就是您要找的。


我们的
这样可以解析任意数量的头,但合并结果树始终是当前分支头的树,实际上忽略了所有其他分支的所有更改。它是用来取代旧分支的旧发展历史。


more ... http://www.kernel.org/pub/software/scm/git/docs/ git-merge.html


I am using git and I have two branches: production and master. At this time production is 9 months old and a lot of changes have gone into master branch.

I am using capistrano and so I need to push all the changes to production branch so that I could deploy. However when I merge I get tons of merge conflicts. I don't care about merge issues because I want my production branch to be overridden by master branch. Is there a way to do it.

If not I was thinking of creating a branch of production called production_old. Then delete everything in production branch and then merge from master.

I am using github.

解决方案

Maybe the ours merge strategy is what you are looking for.

ours This resolves any number of heads, but the resulting tree of the merge is always that of the current branch head, effectively ignoring all changes from all other branches. It is meant to be used to supersede old development history of side branches.

more ... http://www.kernel.org/pub/software/scm/git/docs/git-merge.html

这篇关于如何在git中使用override选项将分支合并到另一个分支中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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