mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 15:36:21 -04:00
66 lines
1.1 KiB
Bash
Executable file
66 lines
1.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
get_config() {
|
|
cmd_get_config="$(git config --get-all extras.info.config-grep)"
|
|
if [ -z "$cmd_get_config" ]; then
|
|
git config --list
|
|
else
|
|
eval "$cmd_get_config"
|
|
fi
|
|
}
|
|
|
|
most_recent_commit() {
|
|
cmd_get_log="$(git config --get-all extras.info.log)"
|
|
if [ -z "$cmd_get_log" ]; then
|
|
git log --max-count=1 --pretty=short
|
|
else
|
|
eval "$cmd_get_log"
|
|
fi
|
|
}
|
|
|
|
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
|