One Tip a Week: git trigger

This week’s tip of the week is a git alias for triggering continuous integration (CI) builds.

If you haven’t already, check out my earlier post on git aliases for conventional commits. This tip builds right on top of that idea.

Sometimes you just need your CI/CD pipeline to run again without making any code changes. Maybe the failure was due to a flaky test, or maybe an external dependency was down. Instead of re-pushing or making a meaningless whitespace change, you can create an empty commit.

Here’s the alias I use:

git config --global alias.trigger "commit --allow-empty -m 'chore: trigger build'"

Quick breakdown:

  • --allow-empty lets you make a commit even if there are no file changes.

  • -m sets the commit message

  • I use a conventional commits message, chore: trigger build

Once that’s set up, you can trigger a new build with:

git trigger
git push

It keeps your workflow clean and avoids messy history changes like amending or force pushing.

That’s it! Short and sweet. Until the next one!