https://github.com/kumak1/kcg
Easily and Parallel manage multiple repositories. kcg is "kumak1 Convenient Git" tools.
https://github.com/kumak1/kcg
cli command-line command-line-tool git go golang homebrew
Last synced: 5 months ago
JSON representation
Easily and Parallel manage multiple repositories. kcg is "kumak1 Convenient Git" tools.
- Host: GitHub
- URL: https://github.com/kumak1/kcg
- Owner: kumak1
- License: apache-2.0
- Created: 2022-12-29T02:24:35.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-15T03:43:20.000Z (over 2 years ago)
- Last Synced: 2024-06-20T12:35:50.370Z (about 2 years ago)
- Topics: cli, command-line, command-line-tool, git, go, golang, homebrew
- Language: Go
- Homepage:
- Size: 245 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kcg

[](https://goreportcard.com/report/github.com/kumak1/kcg)



[](https://coveralls.io/github/kumak1/kcg)

[日本語ドキュメント (Japanese Documents Available)](README_JA.md)
## Table of Contents
- [Overview](#overview)
- [Install](#install)
- [Getting Started](#getting-started)
- [Quick Start Example](#quick-start-example)
- [Usage](#usage)
- [Exec command usage](#execute-specify-commands)
- [Example](#set-and-execute-example)
## Overview
If you use multiple repositories in your application development, you may have found it tedious to `git switch main` and `git pull` for each one. `kcg` is a tool that reduces this hassle a little.
#### Features
- Easily manage multiple repositories
- Narrow down the target with `filter` or `group` option.
## Install
#### homebrew
```shell
brew tap kumak1/homebrew-ktools
brew install kcg
```
#### go
```shell
go get github.com/kumak1/kcg@latest
```
## Getting Started
default configuration file place is `~/.kcg` .
| command | description |
|:----------------------------------------------------------|:---------------------------------------------------------------------------------------------------------|
| `kcg configure init` | Generate configuration file (if not file exists) |
| `kcg configure import --ghq` | Add setting managed by [ghq](https://github.com/x-motemen/ghq) |
| `kcg configure import --path="path/to/config"` | Import settings from specified file into configure file ( `~/.kcg` ) |
| `kcg configure import --url="url/to/config"` | Import settings from specified url file into configure file ( `~/.kcg` ) |
| `kcg configure set --repo="git@host:org/repo.git"` | Set repository setting (required) |
| `kcg configure set --path="path/to/repo"` | Set repository save path setting(required. [ghq](https://github.com/x-motemen/ghq) user is not required) |
| `kcg configure set --group="group_a"` | Set group setting |
| `kcg configure add --group="group_a"` | Add group setting |
| `kcg configure set --branch-alias="main:master"` | Set branch alias setting.
example: `main` to `master` |
| `kcg configure add --branch-alias="main:master"` | Add branch alias setting.
example: `main` to `master` |
| `kcg configure delete ` | Delete repository setting |
#### Quick Start Example
```shell
kcg configure init
kcg configure set kumak1/kcg \
--repo="git@github.com:kumak1/kcg.git" \
--path="~/src/github.com/kumak1/kcg/"
```
if you using [ghq](https://github.com/x-motemen/ghq)
```shell
kcg configure import --ghq
```
#### Share config file Example
##### sender
```shell
kcg configure export --filter="kcg" | gh gist create --public
```
##### receiver
```shell
kcg configure import --url="gist_raw_file_url"
```
## Usage
| command | description |
|:---------------------------|:---------------------------------------------------------------|
| `kcg ls` | Show repository data in configuration file. |
| `kcg cleanup` | Delete merged branch on each repository in configuration file. |
| `kcg clone` | Run `git clone` on each repository in configure file. |
| `kcg pull` | Run `git pull` on each repository in configure file. |
| `kcg switch ` | Run `git switch` on each repository in configure file. |
Can use narrow down repository option. `--filter="needle"` `--group="group_name"`
## Execute Specify Commands
| command | description |
|:-----------------------------------------------------|:---------------------------------|
| `kcg exec list` | Show registered exec commands. |
| `kcg exec set -n "command_name" -c "command"` | Register exec commands. |
| `kcg exec ` | Execute registered commands. |
Can use narrow down repository option. `--filter="needle"` `--group="group_name"`
### Set and Execute Example
```shell
% kcg exec set kumak1/kcg --name="test" --command="go test -race -covermode atomic --coverprofile=coverage.out ./..."
% kcg exec list
test:
kumak1/kcg
% kcg exec test
✔ kumak1/kcg
run go test -race -covermode atomic --coverprofile=coverage.out ./...
? github.com/kumak1/kcg [no test files]
? github.com/kumak1/kcg/cmd [no test files]
ok github.com/kumak1/kcg/exec 1.410s coverage: 100.0% of statements
ok github.com/kumak1/kcg/exec/ghq 0.961s coverage: 100.0% of statements
ok github.com/kumak1/kcg/exec/git 0.573s coverage: 100.0% of statements
ok github.com/kumak1/kcg/kcg 1.081s coverage: 100.0% of statements
```
#### Command Details
```shell
% kcg -h
This is git command wrapper CLI.
Usage:
kcg [command]
Available Commands:
cleanup delete merged branch on each repository dir
clone run `git clone` each repository
completion Generate the autocompletion script for the specified shell
configure Operate config file
exec Run commands on each repository
help Help about any command
ls Show repository list.
pull run `git pull` on each repository dir
switch run `git switch` on each repository dir
Flags:
--config string config file (default is $HOME/.kcg)
-h, --help help for kcg
-v, --version version for kcg
Use "kcg [command] --help" for more information about a command.
```