LinuxCommandLibrary

git-repl

Interact with a Git repository interactively

TLDR

Start an interactive Git shell

$ git repl
copy

Run a Git command while in the interactive Git shell
$ [git_subcommand] [command_arguments]
copy

Run an external (non-Git) command while in the interactive Git shell
$ ![command] [command_arguments]
copy

Exit the interactive Git shell (or press )
$ exit
copy

SYNOPSIS

git-repl [options] [path/to/repo]

PARAMETERS

-h, --help
    Display help message and exit

-v, --version
    Show git-repl version

--repo PATH
    Specify Git repository path (default: current directory)

--no-completion
    Disable tab completion

--history-file FILE
    Path to REPL history file (default: ~/.git-repl-history)

--prompt PROMPT
    Custom REPL prompt string

DESCRIPTION

git-repl is a third-party command-line REPL tool for Git, allowing users to interactively execute Git commands in a read-eval-print loop environment. Unlike standard Git subcommands, it provides a persistent shell-like interface where you can run git status, git commit, and more without prefixing each with 'git'. It maintains context within a repository, supports tab completion for Git commands and options, and offers syntax highlighting for better usability.

Primarily implemented in Python using libraries like prompt_toolkit for the REPL interface and GitPython for repository interactions, it simplifies complex workflows like rebasing or branching by enabling quick iteration. Install via pip install git-repl. Note: not part of core Git; requires Python 3.6+. Ideal for developers experimenting with Git or scripting interactive sessions.

CAVEATS

Third-party tool, not in core Git. Requires GitPython and prompt_toolkit. May not support all Git features or porcelain commands perfectly. Use in trusted repos only due to shell-like execution.

INSTALLATION

pip install git-repl or clone from https://github.com/tscatterford/git-repl and run pip install -e .

EXAMPLES

git-repl # Start in current repo
git-repl /path/to/repo # Start in specific repo
Inside REPL: status → runs 'git status'; quit to exit.

HISTORY

Developed by tscatterford; first released on GitHub in 2020. Inspired by REPLs in languages like Python/IPython. Active maintenance with updates for newer Git versions and Python 3.10+ compatibility.

SEE ALSO

git(1), bash(1), python(1)

Copied to clipboard