如何在不实际合并的情况下测试合并 [英] How to test a merge without actually merging first

查看:204
本文介绍了如何在不实际合并的情况下测试合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在两个分支之间模拟 git merge 是否有任何方法,当前工作分支和主分支,但是不做任何更改?

Is there any way of simulating a git merge between two branches, the current working branch and the master, but without making any changes?

当我必须创建 git merge 时,我经常发生冲突。有没有什么方法可以先模拟合并?

I often have conflicts when I have to make a git merge. Is there any way of simulating the merge first?

推荐答案

我不认为有什么方法可以模拟直到你尝试合并。但是,如果在执行合并之前确保 git status 的输出为空,那么继续尝试它是非常安全的。如果您遇到冲突,您可以立即回到之前的状态:

I don't think there is a way of simulating what will happen until you try the merge. However, if you make sure that the output of git status is empty before you do the merge, it is quite safe to just go ahead and try it. If you get conflicts, you can immediately get back to the state you were at before with:

git reset --merge

从git 1.7.4开始,您还可以通过执行来中止合并:

Since git 1.7.4, you can also abort the merge by doing:

git merge --abort

(作为添加了该选项的提交消息解释,为了与 git保持一致,添加了该消息rebase --abort 等等。)

(As the commit message that added that option explains, this was added for consistency with git rebase --abort and so on.)

这篇关于如何在不实际合并的情况下测试合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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