The relationship between branches and channels

Overview

This article breaks down the relationship between branches and channels, and contains the following topics:

Defining branches and channels

Workflow breakdown

How to assign a branch

How to setup auto-assign

Basics

A branch is a git branch. Whenever you push to Ionic Pro, you specify a branch. For example, git push ionic master pushes your app to Ionic Pro in the master branch. git push ionic foo pushes to the foo branch. You're free to use whatever branch name you'd like. Furthermore, every time you push to Ionic Pro, that copy of the app is automatically built in Ionic Pro.

A channel is a categorized build. And any build can be assigned to a channel. For example, if there's a build in Ionic Pro that you'd like to designate as the production version, you can assign it to the Production channel. The default channels are Master and Production, although you are free to create new channels. For example, you might create a channel named Beta and use it to hold a beta version build of your app.

The flow of pushes, builds and channels

Both Ionic Deploy (live updates) and Ionic View use channels. For Deploy, you can set up your app to watch a channel, and when you assign a build to the channel, the app will automatically use it. View works similarly — if you share the app channel with someone, they'll can use View to see the assigned build.

In this diagram, one build has been assigned to the Master channel. Another is assigned to the Beta channel, which has been shared with some View users. Another build is assigned to the Production channel, which is being watched by the app running on someone's phone.

You may ask "if any build can be assigned to any channel, what's the point of using branches?"

The answer is that a branch can set up to be automatically assigned to a channel. By default the master branch is auto-assigned to the Master branch. But you could specify that pushes to the beta branch be assigned to a channel named Beta. You could even specify that the foo branch go to some branch (you can use any branch name you'd like), and either manually assign those builds to a channel, or auto-assign them.

Three key facts

Here are three key facts to keep in mind:

Every time you do a git push to Ionic Pro, Pro does a build of that code and makes note of the branch.

Any build can be assigned to any channel.

Any branch name can be automatically assigned to a channel.

To assign a branch

To assign a branch to a channel, go to the builds list and click on the assign button, then choose a channel.

To set up auto-assign

To set up auto-assign, choose a channel, then go to settings and specify the name of the branch to automatically be assigned.