How to omit one stage when include a remote pipeline

Replace this template with your information

Our devops team provides a common pipeline, but we don’t need some stages or jobs in our project.
How to disable them easily.

Here is an example of what devops provides in remote pipeline file.

prepare code:
  stage: prepare
  script:
  - xxxxx

build code:
  stage: build
  script:
  - xxxxx

test code:
  stage: test
  script:
  - xxxxx

deploy code:
  stage: deploy
  script:
  - xxxxx

What we expected is to skip the test stage.

What we do is only include stages that we need in our gitlab-ci.yml.

include:
- project: xxxx
  ref: release-1.0
  file: common.gitlab-ci.yml

stages:
- prepare
- build
- deploy

What we got is an error while we lint the pipeline.

test code job: chosen stage does not exist;

any thoughts?