冲突和隐藏 [英] Conflicts from apply and stash

查看:125
本文介绍了冲突和隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在阅读一些教程/ stackoveflow内容时,我读到了存储和应用冲突。



例如:(From p>

While reading some tutorials/stackoveflow content, I read that conflicts can also occur with stash and apply.

For example: (From git-scm/git-apply---3way

-3

--3way

When the patch does not apply cleanly, fall back on 3-way merge if the patch records the identity of blobs it is supposed to apply to, and we have those blobs available locally, possibly leaving the conflict markers in the files in the working tree for the user to resolve. This option implies the --index option, and is incompatible with the --reject and the --cached options.

Is When the patch does not apply cleanly equal to getting conflicts?

How can we get conflicts not from merging operations? Are those conflicts any different then merge conflicts? I would love to see some graph examples.

解决方案

Is When the patch does not apply cleanly equal to getting conflicts?

No: it is not applied "cleanly" when it cannot find the "context" of a hunk (set of lines on a patch) in the target file (the one where you apply the patch).
A patch is using "context diffs" and "unified diffs" (also known as "unidiffs"), which surround each change with context lines (lines that are supposed to be before and after the modification to apply), as well as range (line number where the modification occurs). A patch can then use this "context" to locate the region to be patched even if it has been displaced by changes earlier in the file, using the line numbers in the diffs as a starting point.

But if the modifications of the target do interfere with the patch (meaning: if the context is no longer there in the target file, because of modified or deleted lines), then it (the patch) does not apply cleanly.

How can we get conflicts not from merging operations?

You only get merge conflict when switching to a 3-way merge.
In that case, you have a common ancestor which gives you the ability to know whether or not a chunk is a change from the origin and whether or not changes conflict.
See more on the three-way merge in "Guiffy SureMerge - A Trustworthy 3-Way Merge".

这篇关于冲突和隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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