GitLab CI checkout other branch than master

I have this gitlab-ci script, but it seems that it’s only checking out the master branch. I have added files to a different branch, which I run the pipeline on, but those files are not in the Docker image, only those from master, thus I suspect it’s cloning master.

# syntax = docker/dockerfile:experimental

stages:
  - build
  - test
  - deploy

build:
  stage: build
  image: docker:stable
  services:
    - docker:dind
  before_script:
    - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
    - echo "$CI_REGISTRY_USER $CI_REGISTRY"
  script:
    - echo "$NPMRC" > .npmrc && sed -i 's/\r /\n/g' .npmrc && cat .npmrc
    - export PROJECT_NAME=$(echo ${CI_PROJECT_NAME} | awk '{print tolower($0)}')
    - docker build -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_BRANCH --build-arg BRANCH=$CI_COMMIT_BRANCH .
    - docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$PROJECT_NAME

I should also mention that these other branches are not triggered automatically.