13.11.2025 | Marc Hitscherich

Calculate next suitable version tag from git

calc-release.sh
#!/bin/bash

latest=$(git tag -l | sort -V | tail -n1)
semver_parts=(${latest//./ })
major=${semver_parts[0]}
minor=${semver_parts[1]}
patch=${semver_parts[2]}

patch_version=${major}.${minor}.$((patch+1))
minor_version=${major}.$((minor+1)).0
major_version=$((major+1)).0.0

echo "latest:        $latest"
echo "patch release: $patch_version"
echo "minor release: $minor_version"
echo "major release: $major_version"

Issue:

You would like to automatically and programmatically find the next suitable version number for a release in Git.

Prerequisites:

You are working by semantic versioning principles.

Solution:

Save and execute the provided snippet into your terminal.

Weitere DevBits

13.11.2025 | Peter Majmesku

Install the Latest GitFlow Version on macOS

sh
15.01.2026 | Mathias Grab

Show installed module information via composer

terminal.sh
# Syntax.
composer show vendor/package

# Example.
composer show drupal/eca

terminal_result.sh
name     : drupal/eca
descrip. : Event, Conditions, Actions - powerful, versatile, and user-friendly rules engine for Drupal
keywords : 
versions : * 2.1.0
type     : drupal-module
license  : GNU General Public License v2.0 or later (GPL-2.0-or-later) (OSI approved) https://spdx.org/licenses/GPL-2.0-or-later.html#licenseText
homepage : https://www.drupal.org/project/eca
source   : [git] https://git.drupalcode.org/project/eca.git 2.1.0
dist     : [zip] https://ftp.drupal.org/files/projects/eca-2.1.0.zip 2.1.0
path     : /var/www/html/web/modules/contrib/eca
names    : drupal/eca

support
source : https://drupal.org/project/eca
issues : https://drupal.org/project/issues/eca

requires
dragonmantank/cron-expression ^3.1
drupal/core ^10.3||^11
ext-dom *
ext-json *
mtownsend/xml-to-array ^2.0
php >=8.1

requires (dev)
drupal/eca_ui *
drupal/entity_reference_revisions ^1.12
drupal/inline_entity_form ^3.0
drupal/paragraphs ^1.18
drupal/token ^1.15
drupal/webform dev-3465838-drupal-11-compatibility

sh
composer