Skip to content

Instantly share code, notes, and snippets.

@shrwnsan
Last active October 11, 2015 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save shrwnsan/3937631 to your computer and use it in GitHub Desktop.
Save shrwnsan/3937631 to your computer and use it in GitHub Desktop.
Git Info — Almost Like “svn info”. Write up via http://justamemo.com/2009/02/09/git-info-almost-like-svn-info/
alias gi='. /Users/$USER/git-info.sh'
#!/bin/bash
# author: Duane Johnson
# email: duane.johnson@gmail.com
# date: 2008 Jun 12
# license: MIT
#
# Based on discussion at http://kerneltrap.org/mailarchive/git/2007/11/12/406496
pushd . >/dev/null
# Find base of git directory
while [ ! -d .git ] && [ ! `pwd` = "/" ]; do cd ..; done
# Show various information about this git directory
if [ -d .git ]; then
echo "== Remote URL: `git remote -v`"
echo "== Remote Branches: "
git branch -r
echo
echo "== Local Branches:"
git branch
echo
echo "== Configuration (.git/config)"
cat .git/config
echo
echo "== Most Recent Commit"
git —no-pager log —max-count=1
echo
echo "Type 'git log' for more commits, or 'git show' for full commit details."
else
echo "Not a git repository."
fi
popd >/dev/null
@shrwnsan
Copy link
Author

Write-up via my blog post @ http://j.mp/sv5ZMx (Just a Memo)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment