Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I manipulate a branch that is not the triggering branch in a pipeline?

Christof Koegler _Gaims GmbH_
Contributor
September 27, 2022

I have the following scenario:

Whenever file A changes in branch 'develop', I want to copy these changes to branch 'main'.

I added a step to my pipeline which triggers whenever file A changes in branch 'develop', but apparently Bitbucket only clones the triggering branch, so 'main' is not available in the pipeline.

I have tried to fetch, pull, checkout -b, etc. but to no avail. I also tried re-cloning the whole repository, but have run into permission issues.

How can I go about this?

1 answer

1 accepted

1 vote
Answer accepted
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 27, 2022

Hey @Christof Koegler _Gaims GmbH_ 

Welcome to the community.

I believe you are missing the 'main' branch because, by default, the Bitbucket pipeline only does a shallow clone of your repository, which only includes the triggered branch.

To fix this, simply add full clone depth in your YAML which should trigger the full clone as mentioned in our guide here. 

clone:
depth: full # include full clone
pipelines:
default:
- step:
name: Cloning
script:
- echo "Clone all the things!"

Cheers,
Syahrul

Christof Koegler _Gaims GmbH_
Contributor
September 29, 2022

Thanks, @Syahrul!

Cheers,
Chris

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events