如何使用ruby git pre-commit钩子打印所有暂存的文件名? [英] How to print all the staged file names using ruby git pre-commit hook?
本文介绍了如何使用ruby git pre-commit钩子打印所有暂存的文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚开始使用Ruby玩git钩子(对红宝石更满意).
I just started playing around with git hooks using Ruby(as am more comfortable with ruby).
谁能告诉我如何打印所有暂存的文件名?谁能告诉我或给我很好的资源,在这里我可以理解git将如何搜索暂存的文件并搜索特定的文本?
Can anyone tell me how to print all the staged file names? and can anyone tell me or give me a good resource where I can understand how will git search through the staged files and search for a particular text?
推荐答案
一个可能的命令是(来自" Git预提交钩子:更改/添加的文件):
One possible command is (from "Git pre-commit hook : changed/added files"):
git diff --cached --name-only --diff-filter=ACM
这就是我建议使用的其他红宝石预提交钩子"
您可以将其与" jish/pre-commit
"一起使用.
And you could use it with "jish/pre-commit
".
这篇关于如何使用ruby git pre-commit钩子打印所有暂存的文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文