Git合并,同时放弃任何以前的更改(在本地存储库或从上次提交) [英] Git merge while discarding any previous changes(In local repository or from the last commit)

查看:350
本文介绍了Git合并,同时放弃任何以前的更改(在本地存储库或从上次提交)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Git中,在合并过程中,我们可以告诉git在发生冲突时丢弃本地更改并应用合并分支中的更改吗?



我的意思是,如果有办法,那么我们可以像分支合并一样进行合并,而不会发生冲突。

想了解合并策略'他们'和'我们'。合并时,您可以指定您当前的分支(我们)或远程分支(他们的)是正确的分支。


In Git, during a merge, is there a way that we can tell git to discard local changes in case of a conflict and apply the changes from the merged branch?

I mean if there is a way, then we can do merges like branch merges without conflicts.

解决方案

It sounds like you want to read about the merge strategies 'theirs' and 'ours'. When merging you can specify that either your current branch (ours) or the remote branch (theirs) is the correct one.

这篇关于Git合并,同时放弃任何以前的更改(在本地存储库或从上次提交)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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