git 前状态或 post-状态挂钩
git pre-status or post-status hook
我想 运行 在 git status
上进行 linter,但是似乎没有 pre-status
和 post-status
挂钩。 如何给 git 添加一个钩子? fine docs 对此事保持沉默令人怀疑!
我目前正在将我的 linter 和 git status
包装在 Bash 脚本中,但我更喜欢支持我的肌肉记忆宏 git status
的解决方案。如果重要的话,我会 运行将 CentOS 7.3 与 KDE 4 结合使用。
Git 挂钩用于(将要)修改存储库或工作树的操作。由于 git status
是一个 read-only 操作,因此没有钩子。
I'm currently wrapping my linter and git status
in a Bash script, but
I would prefer a solution which supports my muscle-memory-macro git status
.
您可以将您的 git
命令包装到以下不需要调整您的肌肉记忆的函数中:
git()
{
if [[ $# -ge 1 && "" == "status" ]]
then
echo Your git-status pre-hook should be here
fi
command git "$@"
}
我想 运行 在 git status
上进行 linter,但是似乎没有 pre-status
和 post-status
挂钩。 如何给 git 添加一个钩子? fine docs 对此事保持沉默令人怀疑!
我目前正在将我的 linter 和 git status
包装在 Bash 脚本中,但我更喜欢支持我的肌肉记忆宏 git status
的解决方案。如果重要的话,我会 运行将 CentOS 7.3 与 KDE 4 结合使用。
Git 挂钩用于(将要)修改存储库或工作树的操作。由于 git status
是一个 read-only 操作,因此没有钩子。
I'm currently wrapping my linter and
git status
in a Bash script, but I would prefer a solution which supports my muscle-memory-macrogit status
.
您可以将您的 git
命令包装到以下不需要调整您的肌肉记忆的函数中:
git()
{
if [[ $# -ge 1 && "" == "status" ]]
then
echo Your git-status pre-hook should be here
fi
command git "$@"
}