Sublime Forum

Custom commit command?


I’m looking to run a specific command upon committing – in this case, running a formatter. Is there a way to hook this in? It would be running a cmake command.



You should be able to do that via git hooks, where you’d use a pre-commit hook if you want to modify what’s about to be commited (and block the commit if there is a problem) or a post-commit hook if you just want to run a command once the commit is completed; I assume you want the former, though.

There’s not a way to configure something like that directly from within Sublime Merge but in operation it invokes command line git, so git hooks you set up that way will still run unless you choose the Commit without commit hooks option when you do the commit.

1 Like