diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0159aef9e6e796fe015422062b6fc8a821c365d7..5aa4796f9605e68c34006faf5b574ef06cebb32f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -44,6 +44,7 @@ variables:
   # Let composer know what self.version means.
   COMPOSER_ROOT_VERSION: "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}${CI_COMMIT_BRANCH}-dev"
   CONCURRENCY: 32
+  GIT_DEPTH: "3"
 
 ################
 # Stages
diff --git a/.gitlab-ci/pipeline.yml b/.gitlab-ci/pipeline.yml
index 6c17522d5821a647d153dfc7677c9dac3805e1db..f5e9f5f4344fd2623132658eeef33fe7c525d54e 100644
--- a/.gitlab-ci/pipeline.yml
+++ b/.gitlab-ci/pipeline.yml
@@ -250,8 +250,9 @@ stages:
   <<: [ *with-yarn-cache, *default-job-settings ]
   stage: 🪄 Lint
   script:
-    - git fetch origin
-    - export MODIFIED=`git diff --name-only origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}${CI_COMMIT_BRANCH}|while read r;do echo "$CI_PROJECT_DIR/$r";done|tr "\n" " "`
+    - export TARGET_BRANCH=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}${CI_COMMIT_BRANCH}
+    - git fetch -vn --depth=$GIT_DEPTH "${CI_MERGE_REQUEST_PROJECT_URL:-origin}" "+refs/heads/$TARGET_BRANCH:refs/heads/$TARGET_BRANCH"
+    - export MODIFIED=`git diff --name-only refs/heads/$TARGET_BRANCH|while read r;do echo "$CI_PROJECT_DIR/$r";done|tr "\n" " "`
     - echo $MODIFIED | tr ' ' '\n' | yarn --cwd=./core run -s spellcheck:core --no-must-find-files --file-list stdin
 
 ################