Branch Management

Full branch support is available allowing anyone to create branches of the main / trunk branch, and modify as necessary, then allows you to merge the branch into the trunk repository as desired. This page goes through all main commands regarding branch management, which can also be seen via the branch CLI Commands page of the documentation.

Creeate Branch

You may create a new branch on an already installed package with the branch create CLI command, for example:

apex branch create <PACKAGE> <BRANCH_NAME> [--from-branch <FROM_BRANCH_NAME>]

This will create a branch from the main / trunk branch, and also switch into the new branch meaning you will be developing within the new branch after the above command is successful. If you wish to copy from an existing branch instead of the main / trunk branch, include the --from-branch flag with its value being the name of the branch to copy over into the new branch.

List Branches

You may view a list of all branches available on a package with the branch list CLI Command, for example:

apex branch list <PACKAGE>

View Current Branch

If you ever need to be reminded of which branch you are currently in for a given package, simply run the package info CLI command, such as:

apex package info <PACKAGE>

This will display various details of the given package including the current branch you are in.

Switching Branches

You may switch to a new branch by using the branch switch CLI command, for example:

apex branch switch <PACKAGE> <BRANCH_NAME>

This will switch you over to the designated branch. If you want to switch back over to the main / trunk branch, simply use "trunk" as the branch name.

Merge Branch into Trunk

Once a branch has been tested and approved, you can merge it into the main / trunk branch with the package merge CLI command, for example:

apex package merge <PACKAGE> <BRANCH_NAME> [--dry-run]

This will perform a standard merge from the specified branch into the main / trunk branch, and alert you of any merge conflicts. If the --dry-run flag is present, the merge itself will not be performed, but instead only tested for any merge conflicts that will occur when you actually do the merge.

Delete Branch

If ever needed, you may delete a branch by using the branch delete CLI command, for example:

apex branch delete <PACKAGE> <BRANCH_NAME>

This will confirm whether or not you want to delete the branch, and if yes, the branch will be permanently deleted from the repository.