86 lines
2.7 KiB
Markdown
86 lines
2.7 KiB
Markdown
# commitly
|
|
|
|
A CLI tool for making commits to many subrepos after a distributed change.
|
|
|
|
## Overview
|
|
|
|
`commitly` is a Babashka/Clojure CLI tool designed for monorepo workflows where multiple independent git repositories coexist. When you make changes that span multiple subrepos (e.g., updating documentation, shared configuration, or architecture changes), `commitly` automates the process of committing those changes across all affected repositories.
|
|
|
|
## Features
|
|
|
|
- Automatically detects which subrepos have uncommitted changes
|
|
- Creates commits with a single message across all modified subrepos
|
|
- Push changes to remote repositories after committing
|
|
- View status of all modified repositories
|
|
- Reports commit status for each subrepo
|
|
- Written in Babashka for fast startup and easy distribution
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
# Show status of all modified subrepos
|
|
commitly status
|
|
|
|
# Commit changes across all modified subrepos
|
|
commitly "Your commit message here"
|
|
|
|
# Commit and push changes
|
|
commitly -p "Your commit message here"
|
|
|
|
# Push only (without committing)
|
|
commitly -p
|
|
```
|
|
|
|
## Requirements
|
|
|
|
- [Babashka](https://babashka.org/) installed and available on PATH
|
|
|
|
## Installation
|
|
|
|
### Using bbin (Recommended)
|
|
|
|
Install directly from Gitea using SSH:
|
|
|
|
```bash
|
|
# Install from your Gitea repository via SSH
|
|
bbin install git@git.ajet.fyi:ajet-industries/commitly.git
|
|
|
|
# Install a specific version using a git tag
|
|
bbin install git@git.ajet.fyi:ajet-industries/commitly.git --git/tag v1.0.0
|
|
|
|
# Install the latest commit
|
|
bbin install git@git.ajet.fyi:ajet-industries/commitly.git --latest-sha
|
|
```
|
|
|
|
This will install `commitly` to `~/.local/bin/commitly` (make sure `~/.local/bin` is in your PATH).
|
|
|
|
**Note:** Requires [bbin](https://github.com/babashka/bbin) to be installed first:
|
|
```bash
|
|
bash < <(curl -s https://raw.githubusercontent.com/babashka/bbin/main/bbin)
|
|
```
|
|
|
|
### Manual Installation
|
|
|
|
```bash
|
|
# Make the script executable
|
|
chmod +x commitly
|
|
|
|
# Optionally, symlink to a directory in your PATH
|
|
ln -s $(pwd)/commitly /usr/local/bin/commitly
|
|
```
|
|
|
|
## How It Works
|
|
|
|
1. Scans parent directory for git repositories
|
|
2. Checks each repository for uncommitted changes (staged or unstaged)
|
|
3. Depending on the command:
|
|
- `status`: Shows git status for all modified repositories
|
|
- `<message>`: Commits changes in each modified repository with the provided message
|
|
- `-p <message>`: Commits and pushes changes to remote
|
|
- `-p` (no message): Pushes all repositories without committing
|
|
4. Reports success/failure for each repository
|
|
|
|
## Use Case
|
|
|
|
Perfect for monorepos containing multiple independent services (each with their own `.git` directory) where cross-cutting changes need to be committed atomically with consistent commit messages.
|