Skip to content

git-jock/git-jock-cli

Repository files navigation

Git Jock Cli

Much like this image, the tool is under construction.

Jock

🚧 👷‍♂️ 🏗️ 👷‍♀️ 🚧

Build & Releases
🚀 GitHub Release PyPi 🚀
🧪 Validate Python Coverage Status 🧪
🔐 ShiftLeft Quality Gate Status 🔐

What is Jock CLI?

The CLI is intended to make dealing with multiple connected repositories easier, by grouping repositories and running git commands across them all.

Install

To install or update on Linux or MacOS, you can download from releases or run:

curl -s -L https://raw.githubusercontent.com/git-jock/git-jock-cli/main/scripts/install.sh | bash

⚠️ Note this script uses sudo to move the binary to /usr/local/bin and you should check the script before execution.

Usage

Configuration

Repositories and groups must be configured in ~/.jockrc, in YAML format like below.

Imports can be added with an address, and imported using jock -i/--import-config

repositories:
  auth-service:
    address: [email protected]:some-startup/authentication-service.git
    location: /home/jock/git/authentication-service
  shared-entities:
    address: [email protected]:some-startup/shared-entities.git
    location: ~/shared-entities
  ...
  user-service:
    address: [email protected]:some-startup/user-service.git
    location: ../users

groups:
  services:
    repositories:
      - auth-service
      - user-service

imports:
  my-org:
    address: [email protected]:my-org/local-shop-main.git
    data:
      repositories:
        parent-pom:
          address: [email protected]:my-org/parent-pom.git
          location: ~/git/my-org/parent-pom
        email-service:
          address: [email protected]:my-org/email-service.git
          location: ~/git/my-org/email-service
      groups:
        java:
          repositories:
            - parent-pom
            - email-service
  • address is the remote git address
  • location is the local location, can be relative to home or absolute

CLI Usage

jock [OPTIONS] COMMAND [ARGS] where [OPTIONS] are for jock, COMMAND is the supported git command, and [ARGS] (including flags) are passed to the git COMMAND.

Examples

  • jock -g services clone clones from git address into the specified location for each repo within the services group
  • jock -r auth-service -r user-service pull pulls into the location folders for each repo
  • jock -g services branch --show-current prints the current branch of each repo within the services group

Help

Usage: jock [OPTIONS] COMMAND [ARGS]...

Options:
  --version              Show the version and exit.
  -r, --repository TEXT  Repository, specified in ~/.jockrc, you wish to run
                         commands on. Multiple repositories can be specified
                         using multiple flags.

  -g, --group TEXT       Group of repositories, specified in ~/.jockrc, you
                         wish to run commands on.Multiple  groups can be
                         specified using multiple flags.

  -i, --import-config    Import (or reimport) remote configs.
  --help                 Show this message and exit.

Commands:
  add branch checkout clone commit fetch pull push reset restore rm switch
  • OPTIONS can be --version, --help or a list of repositories such as -r git-jock-cli or --repository some-service
  • COMMAND is any of the currently supported git commands: add, branch, checkout, clone, commit, fetch, pull, push, reset, restore, rm, switch, or tag
  • ARGS are git arguments passed directly to the git command

Roadmap

This is a loose roadmap to explain where the tool will end up, the versions & functionality against them are open to changes.

0.3 +

  • Filtering on branch names
  • Terminal sessions
  • ???

Feel free to suggest feature requests in the issues.

Why is it called Git Jock?

That's Jock at the top, he's good at fetching, pulling etc. and I wish I could clone him. So it's a natural fit.