diff --git a/.travis.yml b/.travis.yml
index 657387324d169775c9bdb3f37fc070f96002a275..bf08d3fa2af3037c538ccef5fa92fb5d6cc0fd41 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,7 +8,12 @@ services:
 before_install:
   - docker pull riot/riotbuild
 
+before_script:
+  # Fetch the base branch when it is not `master`
+  - git fetch origin "${TRAVIS_BRANCH}:${TRAVIS_BRANCH}"
+
 script:
   - docker run -a STDIN -a STDOUT -a STDERR --rm -u "$(id -u)"
+      -e CI_BASE_BRANCH="${TRAVIS_BRANCH}"
       -v "${PWD}:/data/riotbuild" -v /etc/localtime:/etc/localtime:ro
       riot/riotbuild make static-test