Contentstack CLI plugin to do branches operations
npm install @contentstack/cli-cm-branchesIt is Contentstack’s CLI plugin to compare and merge content.

* @contentstack/cli-cm-branches
* Usage
* Commands
For switching to EU region update the hosts at config/default.js
``js`
{
host:'https://eu-api.contentstack.com/v3',
cdn: 'https://eu-cdn.contentstack.com/v3',
...
}
For switching to AZURE-NA region update the hosts at config/default.js
`js`
{
host:'https://azure-na-api.contentstack.com/v3',
cdn: 'https://azure-na-cdn.contentstack.com/v3',
...
}
`sh-session`
$ npm install -g @contentstack/cli-cm-branches
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-branches/1.6.3 linux-x64 node-v22.22.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
...
* csdx cm:branches
* csdx cm:branches:create
* [csdx cm:branches:delete [-uid ](#csdx-cmbranchesdelete--uid-value--k-value)csdx cm:branches:diff [--base-branch
* [](#csdx-cmbranchesdiff---base-branch-value---compare-branch-value--k-value--module-value---format-value---csv-path-value)csdx cm:branches:merge [-k
* [](#csdx-cmbranchesmerge--k-value--compare-branch-value---no-revert---export-summary-path-value---use-merge-summary-value---comment-value---base-branch-value)
List the branches
`
USAGE
$ csdx cm:branches
FLAGS
-k, --stack-api-key=
--verbose Verbose, display information in detailed format.
DESCRIPTION
List the branches
EXAMPLES
$ csdx cm:branches
$ csdx cm:branches --verbose
$ csdx cm:branches -k
`
_See code: src/commands/cm/branches/index.ts_
Create a new branch
`
USAGE
$ csdx cm:branches:create
$ csdx cm:branches:create [--source
$ csdx cm:branches:create [--source
FLAGS
-k, --stack-api-key=
--source=
--uid=
DESCRIPTION
Create a new branch
EXAMPLES
$ csdx cm:branches:create
$ csdx cm:branches:create --source main -uid new_branch -k bltxxxxxxxx
$ csdx cm:branches:create --source main --uid new_branch --stack-api-key bltxxxxxxxx
`
_See code: src/commands/cm/branches/create.ts_
Delete a branch
`
USAGE
$ csdx cm:branches:delete [-uid
$ csdx cm:branches:delete [--uid
FLAGS
-k, --stack-api-key=
-y, --yes Force the deletion of the branch by skipping the confirmation
--uid=
DESCRIPTION
Delete a branch
EXAMPLES
$ csdx cm:branches:delete
$ csdx cm:branches:delete --uid main -k bltxxxxxxxx
$ csdx cm:branches:delete --uid main --stack-api-key bltxxxxxxxx
$ csdx cm:branches:delete --uid main --stack-api-key bltxxxxxxxx --yes
`
_See code: src/commands/cm/branches/delete.ts_
Differences between two branches
`
USAGE
$ csdx cm:branches:diff [--base-branch
FLAGS
-k, --stack-api-key=
--base-branch=
--compare-branch=
--csv-path=
working directory.
--format=
DESCRIPTION
Differences between two branches
EXAMPLES
$ csdx cm:branches:diff
$ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx"
$ csdx cm:branches:diff --compare-branch "develop"
$ csdx cm:branches:diff --compare-branch "develop" --stack-api-key "bltxxxxxxxx"
$ csdx cm:branches:diff --compare-branch "develop" --module "content-types"
$ csdx cm:branches:diff --module "content-types" --format "detailed-text"
$ csdx cm:branches:diff --compare-branch "develop" --format "detailed-text"
$ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx" --base-branch "main"
$ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx" --base-branch "main" --compare-branch "develop"
$ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx" --base-branch "main" --module "content-types"
$ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx" --base-branch "main" --compare-branch "develop" --module "content-types"
$ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx" --base-branch "main" --compare-branch "develop" --module "content-types" --format "detailed-text"
$ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx" --base-branch "main" --compare-branch "develop" --module "content-types" --format "compact-text"
$ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx" --base-branch "main" --compare-branch "develop" --module "content-types" --format "detailed-text" --csv-path "./reports/diff-report.csv"
`
_See code: src/commands/cm/branches/diff.ts_
Merge changes from a branch
`
USAGE
$ csdx cm:branches:merge [-k
[--use-merge-summary
FLAGS
-k, --stack-api-key=
--base-branch=
--comment=
--compare-branch=
--export-summary-path=
--no-revert [optional] If passed, will not create the new revert branch.
--use-merge-summary=
DESCRIPTION
Merge changes from a branch
EXAMPLES
$ csdx cm:branches:merge --stack-api-key bltxxxxxxxx --compare-branch feature-branch
$ csdx cm:branches:merge --stack-api-key bltxxxxxxxx --comment "merge comment"
$ csdx cm:branches:merge -k bltxxxxxxxx --base-branch base-branch
$ csdx cm:branches:merge --export-summary-path file/path
$ csdx cm:branches:merge --use-merge-summary file-path
$ csdx cm:branches:merge -k bltxxxxxxxx --no-revert
$ csdx cm:branches:merge -k bltxxxxxxxx --compare-branch feature-branch --no-revert
``
_See code: src/commands/cm/branches/merge.ts_