diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 134edd4f1cde24367e4d4c20f3c11d7316ab9b17..14f0c91a4e098ae0a388cb4b863593bedfd5f28c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -81,9 +81,12 @@ build-for-production:
       fi
     # If release tag does not already exist, commit and push pom with new version
     - git add pom.xml
-    # Check if there are any changes staged for commit
-    - if ! git diff --cached --quiet; then
-      git commit -m "[ci skip] Set release version ${RELEASE_VERSION}"; git push origin $RELEASE_BRANCH
+    - |
+      if git diff --cached --quiet -- pom.xml; then
+          echo "No changes to commit for pom.xml, skipping commit and push"
+      else
+          git commit -m "[ci skip] Set release version ${RELEASE_VERSION}"
+          git push origin $RELEASE_BRANCH
       fi
     # Build new war file
     - echo "Build war file with version '$RELEASE_VERSION'"