1.2.0 • Published 9 months ago
codeowners-git v1.2.0
codeowners-git
Managing large-scale migrations in big monorepos with multiple codeowners can be overwhelming. Massive PRs touching thousands of files make it hard for teams to review changes efficiently.
codeowners-git solves this by:
- Identifying files owned by specific teams using the CODEOWNERS file.
- Creating compact, team-specific branches with only their affected files.
- Streamlining the review process with smaller, targeted PRs.
https://github.com/user-attachments/assets/7cc0a924-f03e-47f3-baad-63eca9e8e4a8
Installation
Using npx (recommended)
Run commands directly without installation:
npx codeowners-git <command>Install globally via npm
npm install -g codeowners-gitThen run commands directly:
codeowners-git <command>Configuration
The tool automatically detects CODEOWNERS files in:
.github/CODEOWNERSdocs/CODEOWNERSCODEOWNERS(root directory)
Commands
list
List current CODEOWNERS entries.
Usage:
codeowners-git list [options]Options:
--owner, -oFilter by specific owner--include, -iInclude specific patterns
Example:
codeowners-git list -o @myteambranch
Manage branch permissions in CODEOWNERS file.
Usage:
codeowners-git branch [options]Options:
--owner, -oSpecify owner(s) to add/remove--branch, -bSpecify branch pattern--message, -mCommit message for changes--no-verify, -nSkips lint-staged and other checks before committing--push, -pPush branch to remote after commit--remote, -rRemote name to push to (default: "origin")--upstream, -uUpstream branch name (defaults to local branch name)--force, -fForce push to remote--keep-branch-on-failure, -kKeep the created branch even if operation fails
Example:
codeowners-git branch -o @myteam -b "feature/new-feature" -m "Add new feature" -pmulti-branch
Create branches for all codeowners with changes.
Usage:
codeowners-git multi-branch [options]Options:
--branch, -bBase branch name (will be prefixed with codeowner name)--message, -mBase commit message (will be suffixed with codeowner name)--no-verify, -nSkips lint-staged and other checks before committing--push, -pPush branches to remote after commit--remote, -rRemote name to push to (default: "origin")--upstream, -uUpstream branch name pattern (defaults to local branch name)--force, -fForce push to remote--keep-branch-on-failure, -kKeep created branches even if operation fails
Example:
codeowners-git multi-branch -b "feature/new-feature" -m "Add new feature" -pThis will:
- Find all codeowners for the changed files in your repository
- For each codeowner (e.g., @team-a, @team-b):
- Create a branch like
team-a/feature/new-feature - Commit only the files owned by that team
- Add a commit message like "Add new feature - @team-a"
- Push each branch to the remote if the
-pflag is provided
- Create a branch like
Contributing
- Clone the repository
- Install dependencies:
bun install- Make your changes
- Run tests:
bun test- Submit a pull request
Alternatives
License
MIT ©