【问题标题】:Git hooks for symlink convertion on Windows用于在 Windows 上进行符号链接转换的 Git 挂钩
【发布时间】:2014-05-03 02:19:44
【问题描述】:

我尝试在 Windows 上制作 git hooks 来自动将存储库中的 unix 符号链接转换为本地机器上的硬链接+连接窗口。我该怎么做?我们混合使用基于 Windows 和 Unix 的操作系统。

我像这样扩展了 Git 的命令列表 Git Symlinks in Windows

我阅读了有关钩子的信息并创建了结帐后钩子:

#!/bin/sh
exec git rm-symlinks

当我执行 git checkout #branch_with_symlink 时它可以工作,但是当我执行下一次结帐时,git 写道:

error: Your local changes to the following files would be overwritten by checkout:
#path_to_symlink
Please, commit your changes or stash them before you can switch branches.

git 状态:

# On branch #branch_with_symlink
nothing to commit, working directory clean

git 没有 pre-checkout 钩子,我不明白,我是如何进行这种转换的

【问题讨论】:

  • 我有同样的问题(同样的错误,即使没有更改也不允许我切换分支)。与您的不同之处在于我手动创建了连接点(在 Windows 8 中)。看来git有问题。如果您找到解决方案,请分享。

标签: windows git hook symlink


【解决方案1】:

您可以尝试使用污迹过滤器,而不是使用钩子。它们的设计目的是更改文本文件的内容而不是符号链接,但我认为你可以让它们工作。

这里有一些文档:http://git-scm.com/docs/gitattributes#__code_filter_code

【讨论】:

    猜你喜欢
    • 2011-06-03
    • 2015-03-04
    • 2011-08-20
    • 2014-01-03
    • 2017-10-03
    • 2020-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多