Ignore command on specific branch or run only on a branch

Ignore command on a branch

If you don’t want to run a command on a specific branch use the following syntax. In this example we run your command on every branch except gh_pages

if [ "$CI_BRANCH" != "gh-pages" ]; then YOUR_COMMAND; fi

Run command only on one branch

If you want to run a specific command only on one branch use the following syntax. In this example we run your command only on the master branch.

if [ "$CI_BRANCH" == "master" ]; then YOUR_COMMAND; fi

Need More Help?

Get in touch if you need more help, or post on Stack Overflow using the tag #Codeship.