tj.git-extras/bin/git-info
Yuriy VG e7270b3667 git-info: remove notes about git-log, git-show
auxiliary message distracting from the main message
2020-08-21 16:14:54 +03:00

56 lines
861 B
Bash
Executable file

#!/usr/bin/env bash
get_config() {
git config --list
}
most_recent_commit() {
git log --max-count=1 --pretty=short
}
submodules() {
# short sha1
git submodule status | sed 's/\([^abcdef0-9]\{,2\}\)\([abcdef0-9]\{7\}\)\([abcdef0-9]\{33\}\)\(.*\)/\1\2\4/'
}
local_branches() {
git branch
}
remote_branches() {
git branch -r
}
remote_urls() {
git remote -v
}
echon() {
echo "$@"
echo
}
echo
echon "## Remote URLs:"
echon "$(remote_urls)"
echon "## Remote Branches:"
echon "$(remote_branches)"
echon "## Local Branches:"
echon "$(local_branches)"
SUBMODULES_LOG=$(submodules)
if [ ! -z "$SUBMODULES_LOG" ]; then
echon "## Submodule(s):"
echon "$SUBMODULES_LOG"
fi
echon "## Most Recent Commit:"
echon "$(most_recent_commit)"
if test "$1" != "--no-config"; then
echon "## Configuration (.git/config):"
echon "$(get_config)"
fi