Blog

Eric Peterson

December 21, 2017

Spread the word


Share your thoughts

A short one but a good one today. Let's see how we can automate tasks with [CommandBox Githooks.](https://www.forgebox.io/view/commandbox-githooks)

CommandBox Githooks

What are Githooks?

Githooks run on different git actions, like pre-commit and post-checkout. They allow you to hook in to git's lifecycle to execute tasks. Some examples of these tasks are enforcing a commit message format in pre-commit or installing dependencies in post-checkout. This is more useful than it may sound — I know I often forget to install new dependencies when checking out a branch. Automating that step helps me spend less time debugging in the wrong direction.

Running Githooks with CommandBox

CommandBox Githooks lets you use CommandBox, CFML, and your box.json to manage these githooks for your project. You configure it in three steps.

  1. Install commandbox-githooks for CommandBox. This step only needs to be done once per CommandBox installation.
  2. Configure CommandBox Githooks for your repository by running githooks install. This will set up CommandBox to handle the githooks.

    Note: This needs to be done on each user's local repository as githooks are not synced.

  3. Add a githooks struct to your box.json. The keys of this struct are the camel-case names of the githooks (post-checkout => postCheckout). The value is either a single command or an array of commands to run for the githook.

Let's show you what this actually looks like:

Wrap up

CommandBox Githooks can save you mental energy and time debugging by helping you automate githook tasks with CommandBox and CFML. Try it out today!

Recent Entries

Hackers demand a ransom to restore data from my ColdFusion web applications!

Hackers demand a ransom to restore data from my ColdFusion web applications!

Hackers demand a ransom to restore data from my ColdFusion web applications!

Unfortunately, we often hear this message from clients who thought it would never happen to them... until it did. Some believed they could delay the expense of Implementing ColdFusion security best practices for one year, while others were tempted to put it off for just a few months. However, in today's rapidly evolving digital landscape, the security of web applications, including ColdFusio...

Cristobal Escobar
Cristobal Escobar
April 16, 2024
Ortus March Newsletter

Ortus March Newsletter

Welcome to Ortus Solutions’ monthly roundup, where we're thrilled to showcase cutting-edge advancements, product updates, and exciting events! Join us as we delve into the latest innovations shaping the future of technology.

Maria Jose Herrera
Maria Jose Herrera
April 01, 2024
Into the Box 2024 Last Early Bird Days!

Into the Box 2024 Last Early Bird Days!

Time is ticking, with less than 60 days remaining until the excitement of Into the Box 2024 unfolds! Don't let this golden opportunity slip away; our exclusive Early Bird Pricing is here for a limited time only, available until March 31st. Why wait? Secure your seat now and take advantage of this steal!

Maria Jose Herrera
Maria Jose Herrera
March 20, 2024