git - 是否可以替换 git merge 算法?

标签 git merge git-merge

我想知道是否可以编写我自己的自定义 merge 并使用它来代替标准 merge 。

想到的唯一想法是将它作为 merge.tool 放入配置中,但这将使它在标准 git-merge 之后运行,而不是代替它。

谢谢!

最佳答案

阅读 gitattributes documentation :

Defining a custom merge driver

The definition of a merge driver is done in the .git/config file, not in the gitattributes file, so strictly speaking this manual page is a wrong place to talk about it. However…

To define a custom merge driver filfre, add a section to your $GIT_DIR/config file (or $HOME/.gitconfig file) like this:

[merge "filfre"]
    name = feel-free merge driver
    driver = filfre %O %A %B
    recursive = binary

关于git - 是否可以替换 git merge 算法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12977363/

相关文章:

git - 自定义 Git 命令在执行 git diff 后死于信号 13 (SIGPIPE)

git - 在 git 中编辑分支?

java - 使用 JGit 授权错误推送到 GitLab

ios - 在 Git 上 merge 与 project.pbxproj 的冲突 - Xcode iOS

git - 什么是 merge 冲突?

git - git 似乎无法使用 OSX SSH key

php - Git Rebase 主冲突

git push origin [local-branch] 尝试推送到远程主分支而不是创建一个新分支

r - 合并数据帧并覆盖值

Git pull 覆盖并且不 merge 或确认同一分支(master)上的冲突