Skip to content

Instantly share code, notes, and snippets.

@noqqe
Created November 22, 2010 12:13
Show Gist options
  • Save noqqe/709879 to your computer and use it in GitHub Desktop.
Save noqqe/709879 to your computer and use it in GitHub Desktop.
function to get a quick overview for your git repo
#!/bin/bash
# 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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment