From aaa107161bd7dd12517c30aa3f59b07878090e7f Mon Sep 17 00:00:00 2001 From: Florian Baumann Date: Mon, 22 Nov 2010 13:07:08 +0100 Subject: [PATCH] added git_info function to git plugin --- plugins/git.plugins.bash | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/plugins/git.plugins.bash b/plugins/git.plugins.bash index ad21591..5f4cc51 100644 --- a/plugins/git.plugins.bash +++ b/plugins/git.plugins.bash @@ -17,4 +17,40 @@ function git_remove_missing_files() { # Adds files to git's exclude file (same as .gitignore) function local-ignore() { echo "$1" >> .git/info/exclude -} \ No newline at end of file +} + +# get a quick overview for your git repo +function git_info() { + if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]; then + # print informations + echo "git repo overview" + echo "-----------------" + echo + + # print all remotes and thier details + for remote in $(git remote show); do + echo $remote: + git remote show $remote + echo + done + + # print status of working repo + echo "status:" + if [ -n "$(git status -s 2> /dev/null)" ]; then + git status -s + else + echo "working directory is clean" + fi + + # print at least 5 last log entries + echo + echo "log:" + git log -5 --oneline + echo + + else + echo "you're currently not in a git repository" + + fi +} + -- 2.17.1