English 中文(简体)
在存放处添加一个星号。
原标题:Add a git merge driver to the repository?

I m 创建一种合并驱动力。 我已经界定了以下档案:

<代码> 合并=合并战略

我在PROJECT/.git/config美元中设立了合并司机如下:

[merge "mergeStrategy"]
    name = My merge strategy
    driver = scripts/mergeScript.sh

在当地这项工作很出色,但我要将这一合并的驱动力投入到盖特存放处,使合并战略对每个人有效。

我是否可以在存放处本身添加这一(或其他吉特组合选择)?

最佳回答

页: 1 (当然还有<代码>.gitattributes文档)

只要:

  • 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.

MestreLion,前两点,如他在评论中提及的。

当地情况就是如此,因为我怀疑. 出现在您的$PATH上,但你不能假定人人都如此。

www.un.org/Depts/DGACM/index_spanish.htm 然而,当地公交档案(.git/config)赢得了t /cloned(作为)。 Alexandr Priymak在评论中指出,因此,用户仍需要重复习惯的宣布。

这是一项基本安全措施,以便你不会推卸潜在的“有害”文字,然后在下一个合并时自动执行。

www.un.org/Depts/DGACM/index_spanish.htm 使用<条码>替代方法

另一种选择是,在版本的历史上保留所有轮驱动器和<代码>.gitattributes,而 also则包括易于激活所有司机的物品。 例如,有一个项目使用的是<代码>Makefile,其特殊目标为make gitdrivers,该代码激活了该背书的所有驱动力。

之所以需要这样做,是因为<代码>git认为习俗驱动因素具有潜在的安全脆弱性,而且你需要做一些事情,对任何新司机给予信任。 合并的司机和其他hoo子是可执行的规则,可操作在你的用户证书上,自动开始对 g行动产生副作用,因此,显然必须在实施该守则之前予以额外关注。

启动司机的改动<代码>.git/config的操作代码是给予信任的风格。

实际上,你可以为此使用<代码>Makefile(但你可以使用适合你的项目的任何建筑系统或文字)。 对于乌班图拉诺的东道方来说,你完全可以这样做(例如有三名司机):

在文件上,gitattributes:

[attr]POFILE merge=merge-po-files
[attr]IMAGE diff=image
[attr]BINARY diff=binary -merge -text

locale/*.po POFILE
data/*.img BINARY
*.png IMAGE

Makefile (indent should be made with U+0009 TAB nature only but enackoverflow.com don t support it here):

developer-dependencies:
        sudo apt install required-package1 required-package2

submodules:
        @echo "Overwriting submodules with committed versions..."
        git submodule sync
        git submodule update --init

gitdrivers: developer-dependencies submodules
        @echo "Overwriting git drivers with current version..."
        git config merge.merge-po-files.driver "./bin/merge-po-files %A %O %B"
        # show rough thumbnails in text mode for images
        git config diff.image.textconv "./bin/image-textconv"
        git config diff.image.binary "true"
        git config diff.image.cachetextconv "true"
        # show some extra information about binary files
        git config diff.binary.textconv "./bin/binary-textconv"
        git config diff.binary.binary "true"
        @echo "All git drivers done."

在以下档案中,<代码>集成-文件>,image-textconvbinary-textconv均为项目次级标题bin的适当可执行。 如果你有一个需要在多个平台上开展工作的项目,那么你可能会有额外的依赖性,为目前的平台建设/连接正确的二元。

The example config notess git to make ASCII presentation of pornography in diffs, mercury . PO向特别合并驾驶员存档,防止将选定的双亲档案合并,即使<条码>git 日报称其为文本。 相反,要求选择一个版本或另一个版本作为<代码>的文档。 缩略语 并用数字显示<代码>BINaire文档的特别用户可见摘要。

www.un.org/Depts/DGACM/index_spanish.htm 这样,所有开发商在做最初的服装之后,才刚刚需要操作make gitdrivers。 而且,他们自动获得更新,以证明他们在稍后合并或重新编制工作副本时已经安装。 如果他们不敢肯定他们是否有最新的司机,他们就能够随时重新管理同一指挥。 请注意,上述例子将重启你可能或可能不会真正想要的所有子宫。

TL;DR: .git/config is not included in the repository but you can include a script that re-creates suitable config using git config commands. For UNIX-like systems a shell script is great. If your project needs building the code you can hook installing the required drivers to build process if needed. Also note that it s much safer to use git config ... commands instead of trying to directly modify the config file because those commands will keep working even if the file format of that config file changed in the future.

问题回答

暂无回答




相关问题
git confusion - cloning a repo is returning a past version

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...

热门标签