# Working with channels

## What is a channel

Channels are a way to maintain two related versions of a repository in the same place (a bit like branches in Git).

Formally, a channel is a pointer to a set of changes (the state of a channel is a set of changes).

However, channels are different from Git branches, and do not serve the same purpose. In Pijul, independent changes commute, which means that in many cases where branches are used in Git, there is no need to create a channel in Pijul.

The main differences with Git branches are:

• The identity of a change doesn’t depend on the branch it is on, or in other words, rebase and merge are the same operation in Pijul.
• This implies that conflicts do not mysteriously come back after you solve them (which is what git rerere is for).
• Also, conflicts are between changes, so the resolution of a conflict on one channel solves the same conflict in all other channels.

## What you can do with channels

### Creating a channel

A channel is created by using pijul fork <new-channel>. A succeeding command does not issue any output.

### Listing channels

You can get a list of all channels with pijul channel:

$pijul channel  * main other  The currently active channel is marked with a * (asterisk). ### Switching channels To work effectively with a channel, you need to be able to switch channels, so that any changes you pijul record goes into the channel by default. This way, there is no chance of forgetting the --channel option, for example. Long story short, to change the channel, use $ pijul channel switch other


Do not expect any output here, no news is good news!

### Merging channels

There is no simple way to merge all changes from one channel into another. This being said, the usual workflow currently is:

$pijul log --channel feature  Change EXKC67TCSWSPRG4JP5AK2MYSRG6RCC3N5W3N62KESUUFN3FN6R4AC Author: [] Date: 2020-11-14 02:06:21.014281963 UTC Some change ...  $ pijul apply EXKC67TCSWSPRG4JP5AK2MYSRG6RCC3N5W3N62KESUUFN3FN6R4AC


All changes this change depends upon will be applied as well.

### Deleting and renaming channels

You can delete a channel by using the command pijul channel delete <channel>.

Rename it with pijul channel rename [<old>] <new>, where <old> is optional and defaults to the current channel.