git - 如何在 git 中使用覆盖选项将一个分支 merge 到另一个分支

标签 git

我正在使用 git,我有两个分支:production 和 master。此时生产已有 9 个月大,许多更改已进入 master 分支。

我正在使用 capistrano,所以我需要将所有更改推送到生产分支,以便我可以部署。但是,当我 merge 时,我遇到了大量的 merge 冲突。我不关心 merge 问题,因为我希望我的生产分支被主分支覆盖。有办法吗?

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

我正在使用 github。

最佳答案

也许是 ours merge 策略就是您要找的。

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.

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

关于git - 如何在 git 中使用覆盖选项将一个分支 merge 到另一个分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1922336/

相关文章:

android - 转换为Gradle,如何在现有Git存储库上创建分支?

Git推送正在删除分支

git - 有没有办法 git stash 文件的特定行?

git - VS2012 和 VS2013 争夺 .sln header

git:如何 "retrack"未跟踪文件

git - Hudson - Git - 克隆唯一需要的分支

git - 将 git 从本地机器克隆到我的服务器?

GitHub - 为什么两行被标记为不同而没有任何明显差异?

git - 将 gitflow 功能分支发布到 gerrit

git - 无法通过MacPorts安装Git-core+svn