What Is CI_COMMIT_BRANCH?
CI_COMMIT_BRANCH is the branch name, set only for branch pipelines (not tags or merge request pipelines).
CI_COMMIT_BRANCH lets rules distinguish a branch pipeline from a tag or merge-request pipeline.
When it is empty
It is empty for tag pipelines and detached merge request pipelines. Compare against CI_DEFAULT_BRANCH to gate deploys.
Key takeaways
- CI_COMMIT_BRANCH is the branch name.
- Empty on tag/MR pipelines.
- Compare with CI_DEFAULT_BRANCH to gate deploys.
Related guides
What Is CI_DEFAULT_BRANCH?CI_DEFAULT_BRANCH is the name of a GitLab project default branch in CI. Learn how to gate deploys with it.
What Is CI_COMMIT_REF_NAME?CI_COMMIT_REF_NAME is the branch or tag name for a GitLab CI pipeline. Learn how to use it in rules and namin…
What Is CI_PIPELINE_SOURCE?CI_PIPELINE_SOURCE is how a GitLab CI pipeline was triggered: push, merge_request_event, schedule, and more.…