Search code examples
gitcontinuous-integrationgithub-actionsdevopscicd

Are there any other "special git commit messages" than [skip ci]?


I've seen [skip ci] added to commit messages in git to notify the DevOps platform to skip the CI pipeline for this commit. My guess is git probably doesn't care about [skip ci], but...

  1. I'm wondering are there any other commands that can be added to commit messages? Maybe [fixes #123] when a commit fixes an issue (on your task board), maybe others (but not sure what), just curious.
  2. Is this syntax standardized, or is it highly dependent on the DevOps platform?

Solution

  • Embedding metadata in commit messages goes back a long time. It's not unique to git, people have been embedding these kinds of references in TFVC and SVN and CVS forever.

    The formats aren't standardized though, but they do often follow the same format. Unfortunately, there is no guarantee that a message that works on one platform will work on every other. Even on the same platform, you'll find differences between integrations.

    Azure DevOps is an example where the supported commands depend on whether your repo lives in Azure Repos, BitBucket or GitHub. Azure Boards and Azure Pipelines respond(ed) differently depending on the selected integration.

    There are two kinds of command that spring to mind:

    1. Commands that associate/link/interact with work

    GitHub and Azure and Jira recognize special strings in your commit messages to automatically associate work (issue, user story, task) to a commit. Examples from the docs:

    They all use a pretty common set of messages to link and close, but there is no guarantee they're going to be the same across all platforms.

    2. Commands that influence Continuous Integration / Continuous Delivery

    GitHub Actions and Azure Pipelines and BitBucket Pipelines and just about every other CI/CD platform out there will recognize special hints in commit messages to influence workflow runs.

    These messages again aren't unique to Git, Azure Pipelines, for example, also supports building from TFVC or Subversion and will use these same strings for these other platforms as well.

    Again you'll see that [skip ci] is pretty common, but each platform also has their own special keywords.

    Note that these commands might not even be universal on the same platform. [skip ci] hasn't worked in Azure Pipelines when connected to a GitHub Repo for a long time. This has since been fixed as far as I know.