Reputation: 3857
I want to have rebase on top of staging (or merge with staging) before I deploy to my QA server so it will contain the latest changes + changes from my branch.
As a first step I tried to checkout staging and failed: I have the following configuration in bitbucket-pipelines.yml
merge:
- step:
name: merge with staging
image: node:8
script:
- git remote update
- git fetch origin
- git branch -f staging origin/staging
- git checkout staging
error:
+ git branch -f staging origin/staging
fatal: Not a valid object name: 'origin/staging'.
I did try a lot of other variants that are work locally but everything fails... looks like bitbucket limits access to other branches..
What is the correct way of checking out branches in bitbucket pipelines?
Upvotes: 6
Views: 2288
Reputation: 328
Before the fetch command, you need to configure it with this:
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
Upvotes: 4
Reputation: 3857
the following seems to be the solution for my issue as I can avoid checking out staging:
name: Build and test on QA env
image: node:8
script:
- git fetch origin
- git pull --rebase origin staging --verbose
- npm ci
- npm test
- npm run build
from the other hand it doesn't answer asked question so I leave this 'open' for now
Upvotes: -1