This repository provides a command-line toolkit for managing GitLab repositories at Premise Health. It includes scripts for cloning all repositories in a group and for generating reports on stale branches. The toolkit is designed to streamline repo management and cleanup for engineering teams.
The main entry point is the premise.sh script, which acts as a CLI dispatcher for all available commands:
./premise.sh <command> [options]Available commands:
stale— Find and report stale branches across GitLab repositoriesclone— Clone all repositories in a group/subgroups, preserving directory structure
See below for details on each command and usage examples.
Scans all repositories in a GitLab group (and subgroups) for branches that have not had commits in a specified number of days. Can output to terminal or as a markdown report.
Usage:
./premise.sh stale [options]Options:
| Option | Description |
|---|---|
-g, --group |
GitLab group path (default: premise-health/premise-development) |
-i, --group-id |
GitLab group ID (default: 109214032) |
-d, --days |
Number of days to consider a branch stale (default: 90) |
-s, --search |
Filter branches by name (regex) |
-m, --markdown |
Output report in markdown format (default: terminal) |
-e, --hide-empty |
Do not display repos with no stale branches |
-h, --help |
Show help menu and exit |
Examples:
# Basic usage (default: 90 days, default group)
./premise.sh stale
# Find branches older than 60 days, output as markdown
./premise.sh stale -d 60 -m
# Filter by branch name
./premise.sh stale -s featureClones all repositories in a GitLab group (and subgroups), preserving the group/subgroup directory structure. Useful for onboarding or mass updates.
Usage:
./premise.sh clone [options]Options:
| Option | Description |
|---|---|
-g, --group |
GitLab group path (default: premise-health/premise-development) |
-i, --group-id |
GitLab group ID (default: 109214032) |
-c, --code-dir |
Directory to clone repos into (default: premise-health/premise-development) |
--ignore |
Comma-separated list of repo names to skip |
-h, --help |
Show help menu and exit |
Examples:
# Clone all repos in the default group
./premise.sh clone
# Clone into a custom directory
./premise.sh clone -c ~/code/premise
# Ignore certain repos
./premise.sh clone --ignore repo1,repo2