diff --git a/Commands.md b/Commands.md index fa596142..76606cef 100644 --- a/Commands.md +++ b/Commands.md @@ -392,6 +392,12 @@ Type `exit`, `quit`, or `q` to end the repl session. Any arguments to git repl will be taken as the first command to execute in the repl. +You can specify a default command to run when hitting enter: + +```bash +git config --global git-extras.repl.on-enter-command "git status -sb" +``` + ```bash $ git repl git version 2.34.1 diff --git a/bin/git-repl b/bin/git-repl index a706de37..b6df7271 100755 --- a/bin/git-repl +++ b/bin/git-repl @@ -39,7 +39,13 @@ while true; do # Built-in commands case $cmd in ls) cmd=ls-files;; - "") continue;; + "") + on_enter_cmd=$(git config --get --default '' git-extras.repl.on-enter-command) + if test -n "$on_enter_cmd"; then + eval "$on_enter_cmd" + fi + continue + ;; quit|exit|q) break;; esac diff --git a/man/git-repl.1 b/man/git-repl.1 index b3721f44..bd59954d 100644 --- a/man/git-repl.1 +++ b/man/git-repl.1 @@ -1,6 +1,6 @@ -.\" generated with Ronn-NG/v0.9.1 -.\" http://github.com/apjanke/ronn-ng/tree/0.9.1 -.TH "GIT\-REPL" "1" "September 2024" "" "Git Extras" +.\" generated with Ronn-NG/v0.10.1 +.\" http://github.com/apjanke/ronn-ng/tree/0.10.1 +.TH "GIT\-REPL" "1" "January 2026" "" "Git Extras" .SH "NAME" \fBgit\-repl\fR \- git read\-eval\-print\-loop .SH "SYNOPSIS" @@ -31,6 +31,10 @@ Equivalent of 'git ls\-files'\. exit|quit|q .P Ends the repl session\. +.SH "CONFIGURATION" +You can specify a default command to run when hitting enter: +.P +\fBgit config \-\-global git\-extras\.repl\.on\-enter\-command "git status \-sb"\fR .SH "EXAMPLES" .nf $ git repl diff --git a/man/git-repl.html b/man/git-repl.html index 3f9750e6..e1995ab6 100644 --- a/man/git-repl.html +++ b/man/git-repl.html @@ -1,8 +1,8 @@ - - + + git-repl(1) - git read-eval-print-loop