{"thread":{"id":"39980","subject":"Running pre-commit hook","startedAt":"2015-07-31T14:57:21Z","lastAt":"2015-07-31T14:57:21Z","messageCount":1,"participants":["Ed Avis"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"267198","messageId":"loom.20150731T164948-964@post.gmane.org","threadId":"39980","inReplyTo":null,"subject":"Running pre-commit hook","fromName":"Ed Avis","fromEmail":"eda@waniasset.com","sentAt":"2015-07-31T14:57:21Z","receivedAt":"2015-07-31T14:57:21Z","isPatch":false,"sender":{"key":"eda@waniasset.com","avatar":null},"body":"Currently, git commit --dry-run does not run any hooks, not even pre-commit:\n\n% mkdir test\n% cd test\n% git init\nInitialized empty Git repository in /home/eda/test/.git/\n% ln -s /bin/false .git/hooks/pre-commit\n% touch a\n% git add a\n% git commit --dry-run -m. a >/dev/null && echo yes\nyes\n% git commit -m. a && echo yes\n(fails)\n\nIt would sometimes be useful to run the pre-commit hook without committing,\nfor example to get some initial checks done before prompting the user to enter\na log message.  (git commit itself works this way, of course, but I am\nthinking of development environments and editors that interface to git.)\n\nIs there a way to do a dry run commit that also runs some of the hooks?\n\n-- \nEd Avis <eda@waniasset.com>\n"}]}