Add new Git remotes easily
Find a file
2024-12-14 14:32:17 +01:00
flake.lock update flake 2024-08-13 22:31:47 +02:00
flake.nix update flake 2024-08-13 22:31:47 +02:00
gra handle already existing remotes 2024-11-05 17:14:54 +01:00
gra_completion.bash add bash completion 2024-07-17 22:38:14 +02:00
install.bash add install script 2024-08-13 22:01:11 +02:00
README.org update README 2024-12-14 14:32:17 +01:00

gra

gra (short for git remote add) is a small Bash script which allows to add new Git remotes easily. New remote URLs will be added with the same URL scheme as the one of the origin remote. The only argument which is needed is a REMOTE_NAME,

  $ gra Deleh
  Adding remote origin-Deleh with URL git@github.com:Deleh/example.git
  Fetching from remote origin-Deleh
  From github.com:Deleh/example
   * [new branch]      main       -> origin-Deleh/main

Usage

  Usage: gra [OPTIONS] REMOTE_NAME

  Add a Git remote by providing a single name.  All remotes get listed if no
  REMOTE_NAME is provided.

  REMOTE_NAME  Name of the remote

  OPTIONS
    -h, --help  Show this help message and exit

Shorthands

Shorthands can be defined in ~/.config/gra.config for example like this:

  ex=example
  slu=SuperLongUsername

They can be passed as REMOTE_NAME argument, which is handy for often-used, long remote names. Autocompletion is available for all defined shorthands. Make sure the shorthands adhere to the Bash variable naming rules.

Installation

Manual

Place the gra script in your $PATH. To use the autocompletion feature source the gra_completion.bash script.

Script

An installation script for Bash (install.bash) is provided which will link the two files to ~/.local/{bin/gra,share/bash-completion/completions/gra} and add the corresponding entries to ~/.bashrc. Further updates of gra require just git pull.

Nix Flake

This repository is also a Nix Flake. gra is provided as package under github:Deleh/gra#gra.