Cross git branch information in Bitbucket Pipelines v

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Summary

The user performs a git pull command at build time in Bitbucket Pipelines and notes that the command pulled a commit from a different branch than the one that triggered the build.

Environment

Bitbucket Pipelines

Diagnosis

Using a testing scenario, lets say a build was triggered to the develop branch of a given Bitbucket repository. One of the build commands is a git pull (the goal is to pull any commits that were committed after the build started), and on the output, we can see that a commit from the main branch was pulled:

(Auto-migrated image: description temporarily unavailable)

Cause

This behavior could be caused if you set the clone option to full on the bitbucket-pipelines.yml configuration file:

1 2 clone: depth: full

Solution

To avoid that behavior use the default clone configuration, or at least avoid using the full clone option.

Updated on March 14, 2025

Still need help?

The Atlassian Community is here for you.