Direkt zum Inhalt

Devbits

Kleine Code-Schnipsel aus unserem Alltag mit Drupal, PHP und DevOps: Problem, Lösung, Code.

11.11.2026 | Marc Hitscherich

Git flow hotfix without release tag

By default, git flow hotfix finish creates a release tag. Small fixes, such as config changes or typos, don't always need a new version, but they still need to land in main and develop.

git flow hotfix start fix-short-description
# ... commit changes ...
git flow hotfix finish fix-short-description -n -p

Issue:

By default, git flow hotfix finish creates a release tag. Small fixes, such as config changes or typos, don't always need a new version, but they still need to land in main and develop.

Prerequisites:

git-flow (AVH Edition) is installed and the repository is initialized with git flow init. Ensure that your local main and develop branches are up to date.

Solution:

The -n (--notag) flag finishes the hotfix without creating a tag. The hotfix branch is merged into main and develop and then deleted. The -p (--push) flag then pushes main and develop to origin.

14.10.2026 | Lothar Ferreira Neumann

Require a module that is incompatible with your Drupal Core version

Managing dependencies in a Drupal project where certain modules may not be compatible with the Core version you are using.

# Get lenient.
composer require mglaman/composer-drupal-lenient

# Add the module to the allow list. Use escapes for the quote signs. \" ... \"
composer config --merge --json extra.drupal-lenient.allowed-list '[\"drupal/module_with_incompatible_core_version\"]'

# You can check if the merge worked, either just take a look
# into the composer.json or use this command.
composer config --merge --json extra.drupal-lenient.allowed-list
"drupal-lenient": {
  "allowed-list": [
    "drupal/module_with_incompatible_core_version"
  ]
}

Issue:

Managing dependencies in a Drupal project where certain modules may not be compatible with the Core version you are using.

Prerequisites:

Your project needs to be Composer managed.

Solution:

The code uses the mglaman/composer-drupal-lenient package to allow specific Drupal modules that are incompatible with the core version to be installed without causing version conflicts.

Learn more in the Lenient install tutorial.

05.03.2026 | Lothar Ferreira Neumann

Update a diverged local branch from remote to be on track again

We want to make sure the local 'stage' branch is updated with the latest changes from a specific remote branch before pushing updates back to the 'stage' branch in the repository.

git fetch --all
git checkout stage
# This resets your local stage branch to the version of remote.
# The origin/stage could diverge from the local due to resetting the branch.
git reset --hard origin/stage
git merge origin/BRANCHNAME
git push origin stage
git checkout BRANCHNAME

Issue:

We want to make sure the local 'stage' branch is updated with the latest changes from a specific remote branch before pushing updates back to the 'stage' branch in the repository.

Solution:

The code snippet updates the local 'stage' branch with the latest changes from the remote 'stage' branch, merges updates from another specified branch and pushes these combined updates back to the remote 'stage' branch. Finally, it switches back to the original branch.

13.11.2025 | Marc Hitscherich

Calculate next suitable version tag from git

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

#!/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.