![](/img/trans.png)
[英]Is there a way to run an interactive shell command during a git(-flow) hook?
[英]Is there way to run git hook before/after 'git add' command?
我檢查了git help hooks
,或者這是不可能的,或者我錯過了。
我希望這樣做而不是pre-commit
因為存儲庫中的程序會生成文件,因此我當前的工作流程是
git add -A ruby script_stored_in_repository_that_generates_something.rb <checking generated work that is not tracked in the repository> git commit -m "what was changed"
而且我想消除手動腳本運行毫無意義的情況。
我知道我可以使用pre-commit
鈎子,但是我更喜歡在暫存代碼時編輯工作,而不是還原/撤消/修改提交。
不幸的是,我認為那不存在。 我認為最接近的別名是。 您不能使用別名覆蓋git命令,因此您必須使用與“ add”不同的名稱。
git config alias.ad '!./my_script.sh && git add'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.