【问题标题】:Is it possible to use cache for Git pre-commit hook?是否可以将缓存用于 Git 预提交挂钩?
【发布时间】:2015-12-30 14:21:53
【问题描述】:

我使用预提交挂钩来检查我的项目的代码样式和其他规则。

gulp.task('git-preCommit', ['jscs', 'jshint', 'tslint', 'stylint']);

这个过程通常是长期运行的。我想知道,是否可以在 Git 或 jscs、jshint 等中为更改的文件设置一些缓存。

例如有 150 个 diff 文件,preCommit 成功检查了 149 个并在 1 (path/example.ts) 上抛出了错误。我修复了最后一个,下次提交时 - git cache(或某些工具)会知道我只修复了 1 个文件并只检查这个文件,而不是全部 150 个。

【问题讨论】:

  • 当然,这是配置您正在使用的工具的问题,与提交挂钩 per se 无关。

标签: git caching git-commit pre-commit-hook jscs


【解决方案1】:

Git 没有任何缓存机制或对内容的支持。

所以简单的答案是 NO,它不能在 git 中完成。
您仍然可以使用任何可能适合您的第三方工具。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-31
    • 1970-01-01
    • 2015-04-20
    • 1970-01-01
    • 1970-01-01
    • 2021-09-10
    • 2013-10-05
    • 2013-12-24
    相关资源
    最近更新 更多