Newer
Older
backup-commander / git-info.sh
@John Pearcey John Pearcey on 2 Dec 768 bytes wip
  1. #!/bin/bash
  2.  
  3. # author: Duane Johnson
  4. # email: duane.johnson@gmail.com
  5. # date: 2008 Jun 12
  6. # license: MIT
  7. #
  8. # Based on discussion at http://kerneltrap.org/mailarchive/git/2007/11/12/406496
  9.  
  10. pushd . >/dev/null
  11.  
  12. # Find base of git directory
  13. while [ ! -d .git ] && [ ! `pwd` = "/" ]; do cd ..; done
  14.  
  15. # Show various information about this git directory
  16. if [ -d .git ]; then
  17. echo "== Remote URL: `git remote -v`"
  18.  
  19. echo "== Remote Branches: "
  20. git branch -r
  21. echo
  22.  
  23. echo "== Local Branches:"
  24. git branch
  25. echo
  26.  
  27. echo "== Configuration (.git/config)"
  28. cat .git/config
  29. echo
  30.  
  31. echo "== Most Recent Commit"
  32. git log -1
  33. echo
  34.  
  35. echo "Type 'git log' for more commits, or 'git show' for full commit details."
  36. else
  37. echo "Not a git repository."
  38. fi
  39.  
  40. popd >/dev/null