diff --git a/get-modified-image.sh b/get-modified-image.sh
index 7ad6f52ef05d8a0cd33070d33dba288249f195ac..6d13e0446de87b34f4af3f55565052c801504a1a 100755
--- a/get-modified-image.sh
+++ b/get-modified-image.sh
@@ -4,7 +4,7 @@
 # this script should become obsolete as soon as a proper way of getting the modified files is added to Gitlab CI
 
 RES=""
-for i in $(git log -m -1 --name-only --pretty="format:" $CI_COMMIT_SHA)
+for i in $(git log -m -1 --name-only --pretty="format:" --first-parent)
 do
 	case "$i" in
 		*pica*) RES=$(echo $i | cut -d '/' -f1);;
diff --git a/pica-ci/Dockerfile b/pica-ci/Dockerfile
index f3dde1ff8735cc6760540dee3402bb9dd4acf522..97928e0a353842f8d05a5e980e9a64d860abbfe6 100644
--- a/pica-ci/Dockerfile
+++ b/pica-ci/Dockerfile
@@ -13,7 +13,6 @@ RUN apk update && \
             sed \
             wget && \
     pip install docker-compose && \
-    export CI_COMMIT_SHA=$(git rev-parse HEAD) && \
     chmod +x get-modified-image.sh get-host-by-image.sh && \
     export MODIFIED_IMAGE_FULL=$(./get-modified-image.sh) && \
     export MODIFIED_IMAGE=$(echo $MODIFIED_IMAGE_FULL | cut -d ':' -f1) && \