Jay Shah
Jay Shah

Reputation: 33

How to checkout to specific branch instead of current branch in config.yml file of CircleCI

I want to checkout to a specific branch (ex. master) in the config.yml file of CircleCI v2.1. The below code by default checkout to the current branch but instead I want it to checkout to a specific branch

steps:
  - checkout

I have tried implementing the below code which shows on UI that it got checkout to master but the steps after this command (which are related to archiving the package) still use the code of the current branch.

steps:
  - checkout
  - run: git checkout master

I have also tried removing the "checkout" statement and just keeping "run: git checkout master" but I got fatal: not a git repository (or any of the parent directories): .git error.

I have looked into https://circleci.com/docs/2.0/configuration-reference/#section=configuration document but haven't found anything useful related to this.

Upvotes: 2

Views: 4008

Answers (1)

Related Questions