From 50e47e0be01071b0cd1a787c3d122b3d6f8fc6ef Mon Sep 17 00:00:00 2001 From: nulltask Date: Tue, 27 Mar 2012 17:33:39 +0900 Subject: [PATCH] Added displaying current branch name to git-repl(1) prompt --- bin/git-repl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/git-repl b/bin/git-repl index c7de1b2..c92a954 100755 --- a/bin/git-repl +++ b/bin/git-repl @@ -1,8 +1,19 @@ #!/bin/bash while true; do + # Current branch + cur=`git symbolic-ref HEAD 2> /dev/null | cut -d/ -f3-` + + # Prompt + if [ $cur ] + then + prompt="git ($cur)> " + else + prompt="git> " + fi + # Readline - read -e -r -p "git> " cmd + read -e -r -p "$prompt" cmd # EOF test $? -ne 0 && break