Managing Elixir project versions with git_ops

When developing ELixir applications, I’d like to have an easy way to manage versions. A tool that makes this very easy is git_ops. It is an elixir/hex package which sets up a workflow of versioning your project and git commits using conventional commits.

Conventional commits uses a few easy.. conventions to make your commits parseable by git_ops.

Here’s how I set up git_ops in my projects.

First, search for git_ops on hex, and copy the following line into your deps section of mix.exs:


{:git_ops, "~> 2.4", only: :dev}

Then, move your current version out of the project block like so:

# This is the version that git_ops will update
@version "0.140.0"

# Your project block only references this version now
def project do
    app: :mirage,
    version: @version,
    elixir: "~> 1.12",
    elixirc_paths: elixirc_paths(Mix.env())

Finally, add a convenience alias for easily creating new versions

defp aliases do
    # other aliases
    rel: ["git_ops.release --yes"]


Next, add this configuration block to your config/dev.exs:

config :git_ops,
  mix_project: Mix.Project.get!(),
  changelog_file: "",
  repository_url: "",
  types: [],
  # Instructs the tool to manage your mix version in your `mix.exs` file
  # See below for more information
  manage_mix_version?: true,
  # Instructs the tool to manage the version in your
  # Pass in `true` to use `""` or a string to customize
  manage_readme_version: "",
  version_tag_prefix: "v"

Conventional Commits

Now you are ready to make some commits!

They should now look like this:

  • feat: added some exiting new feature!
  • fix: prevent this nasty bug
  • chore: update webpack

For feat commits, the minor version will be increased, for fix commits, only the patch version will be increased. chore commits will not affect the version.