6

同步 git hook 有啥优秀实践吗?

 2 years ago
source link: https://www.v2ex.com/t/806914
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  git

同步 git hook 有啥优秀实践吗?

  x97bgt · 7 小时 20 分钟前 via iPhone · 207 次点击
最近在研究 git hook,想把代码格式、commit 格式这些统一一下,在 pre-commit 阶段进行检查。

但问题是,hook 所在目录.git 就不会被同步到仓库里。每个人都需要在本地配置一把。

诸如 husky 或 pre-commit 的工具,在 git clone 后也需要 install 一下才会安装好 hook,而且需要本机上有 npm 或 python 。install 这一步不是强制的,万一有人不执行就没用了。

对于这个需求,有啥好办法么?可以强制所有人在 commit 前进行代码和 commit 信息的 lint 的。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK