当将一个分支合并到另一个分支时,可以定义合并策略,例如
git merge release -X ours
当将发布分支中的内容合并到当前分支时,这会在全局范围内应用“我们的”策略。是否可以仅对一个特定文件应用此策略,例如
git merge release -X docs/release-notes.md ours
这样“我们的”策略仅在合并 docs/release-notes.md 文件时使用?或者有人知道实现这一目标的另一种选择吗?
如果你查看帮助,我认为这是不可能的
ours
This option forces conflicting hunks to be auto-resolved cleanly by favoring our version. Changes from the other tree
that do not conflict with our side are reflected to the merge result. For a binary file, the entire contents are taken
from our side.
This should not be confused with the ours merge strategy, which does not even look at what the other tree contains at
all. It discards everything the other tree did, declaring our history contains all that happened in it.
您可以看到没有可用选项的指示,而不是subtree
可能的策略
subtree[=<path>]
This option is a more advanced form of subtree strategy, where the strategy makes a guess on how two trees must be
shifted to match with each other when merging. Instead, the specified path is prefixed (or stripped from the beginning)
to make the shape of two trees to match.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)