Helix TeamHub CLI examples
This section contains examples of how you can manage your repositories using hth-cli.
In this section:
- Code Review Management
- Multi-Repo Code Review Management
- Run commands across repositories using the "hth each" command
Code Review Management
Code reviews are managed using the hth code-review command. The commands can be run inside your local working directory.
hth code-review can be shortened to hth cr.
Create a code review
To create a code review for the current branch, use the hth code-review create command:
❯ hth code-review create
? Destination branch main
? Title Add new feature
? Description (optional)
Creating a code review 'Add new feature' out of the following repository
backend (new-feature > main) for the hth_cli project located at https://my.helixteamhub.com/acme/projects/hth_cli
? Do you want to continue? (y/n) y
✓ Code review created successfully. You can access it at https://my.helixteamhub.com/acme/projects/hth_cli/reviews/1
You can use flags for further customization like selecting the source reference. For more information on the code review commands, see Code Review.
List code reviews
To list the open code reviews for your current project, use the hth code-review list command:
❯ hth cr list Listing the code reviews for the hth_cli project located at https://my.helixteamhub.com/acme/projects/hth_cli. !1 Add new feature
Merge a code review
To merge a code review:
- Find the code review identifier (number) by, for example, using the hth code-review list command.
- Run the hth code-review merge command:
- That's it, you have now merged the code review!
❯ hth code-review merge 1 Merging the code review !1 for the hth_cli project located at https://my.helixteamhub.com/acme/projects/hth_cli. ✓ The code review merged successfully.
Multi-Repo Code Review Management
Helix TeamHub only supports Multi-repo code reviews for Helix Git repositories.
When developing software, it is common to have related changes that affect multiple repositories. Helix TeamHub's Multi-Repo Code Review feature allows you to track changes between multiple repositories, and merge the changes as an atomic transaction.
Multi-Repo Code Reviews are managed using the hth multi-repo-code-review command. The commands can be run inside your local working directory.
hth multi-repo-code-review can be shortened to hth mrcr or hth mcr.
Create a multi-repo code review
To create a multi-repo code review from the references you have currently checked out, run the hth mcr create command in your local working directory:
❯ hth mcr create ? Destination branch of 'backend' repository main ? Destination branch of 'frontend' repository main ? Destination branch of 'infra' repository main ? Title Feature XYZ ? Description (optional) Creating a multi-repo code review 'Feature XYZ' out of the following repositories for the hth_cli project located at https://my.helixteamhub.com/acme/projects/hth_cli backend (feature-xyz > main) frontend (feature-xyz > main) infra (feature-xyz > main) ? Do you want to continue? (y/n) y ✓ Multi-repo code review created successfully. You can access it at https://my.helixteamhub.com/acme/projects/hth_cli/multi-reviews/1
You can use flags for further customization like selecting a custom set of repositories/sources references. For more information on the multi-repo code review commands, see Code Review.
List multi-repo code reviews
To list open multi-repo code reviews for the project, use the hth mcr list command in your local working directory:
❯ hth mcr list Listing the code reviews for the hth_cli project located at https://my.helixteamhub.com/acme/projects/hth_cli. %1 Feature XYZ
Merge a multi-repo code review
To merge a multi-repo code review:
- Find the code review identifier (number) by, for example, using the hth mcr list command.
- Run the hth mcr merge command:
- That's it, you have now merged the multi-repo code review!
❯ hth mcr merge 1 Merging the multi-repo code review %1 for the hth_cli project located at https://my.helixteamhub.com/acme/projects/hth_cli ✓ The multi-repo code review merged successfully.
Run commands across repositories using the "hth each" command
hth-cli enables you to run commands across a set of repositories using the hth each command.
Checkout a new branch
To check out a new branch in Git, prefix the Git branch creation command with hth each:
❯ hth each git checkout -b new-feature Running the command for backend Switched to a new branch 'new-feature' ✓ Command succeeded. Running the command for frontend Switched to a new branch 'new-feature' ✓ Command succeeded. Running the command for docs Switched to a new branch 'new-feature' ✓ Command succeeded.
Add files to multiple repositories
To create a file under each repository, run the following command using hth each:
❯ hth each 'echo "2020.1" > VERSION'
Staging files:
❯ hth each "git add . && git status" Running the command for backend On branch new-feature No commits yet Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: VERSION ✓ Command succeeded. Running the command for frontend On branch new-feature No commits yet Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: VERSION ✓ Command succeeded. Running the command for docs On branch new-feature No commits yet Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: VERSION ✓ Command succeeded.
Create commits
To create commits using hth each:
❯ hth each "git commit -m 'Update VERSION'" Running the command for backend [new-feature (root-commit) 5bc5281] Update VERSION 1 file changed, 1 insertion(+) create mode 100644 VERSION ✓ Command succeeded. Running the command for frontend [new-feature (root-commit) 5bc5281] Update VERSION 1 file changed, 1 insertion(+) create mode 100644 VERSION ✓ Command succeeded. Running the command for docs [new-feature (root-commit) 5bc5281] Update VERSION 1 file changed, 1 insertion(+) create mode 100644 VERSION ✓ Command succeeded.
Push to remote
To push to remote using hth each:
❯ hth each git push -u origin new-feature Running the command for backend Enumerating objects: 3, done. Counting objects: 100% (3/3), done. Writing objects: 100% (3/3), 226 bytes | 226.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) To ssh://my.helixteamhub.com/hth_cli/backend * [new branch] new-feature -> new-feature Branch 'new-feature' set up to track remote branch 'new-feature' from 'origin'. ✓ Command succeeded. Running the command for frontend Enumerating objects: 3, done. Counting objects: 100% (3/3), done. Writing objects: 100% (3/3), 226 bytes | 226.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) To ssh://my.helixteamhub.com/hth_cli/frontend * [new branch] new-feature -> new-feature Branch 'new-feature' set up to track remote branch 'new-feature' from 'origin'. ✓ Command succeeded. Running the command for docs Enumerating objects: 3, done. Counting objects: 100% (3/3), done. Writing objects: 100% (3/3), 226 bytes | 226.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) To ssh://my.helixteamhub.com/hth_cli/docs * [new branch] new-feature -> new-feature Branch 'new-feature' set up to track remote branch 'new-feature' from 'origin'. ✓ Command succeeded.