Add a git merge driver to the repository?

北慕城南 提交于 2019-11-29 03:23:40
VonC

You could simply add and commit (and push) script/mergeScript (along with the .gitattributes file, of course)

That would work as long as:

  • mergeScript is somehow in the $PATH of the user executing the merge driver.
  • mergeScript is executable, chmod +x
  • mergeScript is without extension, to allow you to later change its content (from a bash shell to a Perl script to a C executable to ...) if needed.

(Thank you, MestreLion, for the last two points, as he mentioned them in the comment)

That was the case for you locally, as I suspect that '.' was in your $PATH, but you cannot assume that for everybody.

However, the local config file (.git/config) won't be pushed/cloned (as Alexandr Priymak points out in the comment), so the users still need to replicate the declaration of the custom merge driver.
This is a basic safety measure, in order for you to not push a potential "harmful" script which would then be automatically executed at the next merge.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!