"only:" not working

Hi!
A Have pipeline with deploy to my virtual server for staging.
I want to run it when only commited to dev branch? but its don`t works!
Pipeline not running.
How i can run pipeline that takes code from “dev” branch to deploy it to stage environment?
How to devide deployment to stage and prod?
I must have .gitlab-ci.yml in each branch?

stages:
  - deploy

deploy-my-code-from-dev-to-to-stage-server:
 only:
   - dev
  tags: 
    - shell
  stage: deploy
  script:
    - deploy_to_stage.sh

Whats wrong?
I`m newby
Thanks!

.gitlab-ci.yml must be present in the branch you want to run pipelines for.