在预先承诺的钩子内执行提交
我使用此预钩脚本是因为我运行了一个任务编辑一些类,然后我会自动添加所有编辑的文件并提交它们,但结果是提交已完成,然后添加了文件,但不承诺。似乎在提交之后而不是之前添加了它们。
脚本是:
#!/bin/bash
pwd
cd application
echo "Running Lint and Spotless"
bash gradlew lint spotlessApply
git add *
我该怎么办?
I'm using this pre-hook script because I run a task editing some classes, then I would automatically add all the edited files and commit them, but the result is that the commit is done and then the files are added but not committed. It seems like they are added after the commit and not before it.
The script is this:
#!/bin/bash
pwd
cd application
echo "Running Lint and Spotless"
bash gradlew lint spotlessApply
git add *
How could I do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
git-add(1)更改索引。您不应该更改索引
预设脚本。它可能起作用,但这是不确定的行为。
请参阅:
git-add(1) changes the index. You’re not supposed to change the index in
the pre-commit script. It might work but it is undefined behavior.
See: