tj.git-extras/bin/git-info
Sasha Khamkov ccf029dabe FIX: representation of git-info
- fix representation of `git-info` output

$ git info --no-config

Before:

 ## Remote URLs:\n
 origin	https://github.com/sanusart/git-extras.git (fetch)
 origin	https://github.com/sanusart/git-extras.git (push)
 upstream	https://github.com/visionmedia/git-extras.git (fetch)
 upstream	https://github.com/visionmedia/git-extras.git (push)\n
 ## Remote Branches:\n
   origin/HEAD -> origin/master
   origin/fix_feature_refactor_bug
   origin/gh-pages
   origin/issue234
   origin/master
   origin/patch-1
   upstream/gh-pages
   upstream/master\n
 ## Local Branches:\n
 * master\n
 ## Most Recent Commit:\n
 commit ac18bd16b4
 Merge: 68455cf a1b7120
 Author: hemanth.hm <hemanth.hm@gmail.com>

     Merge pull request #260 from brandondrew/patch-1\n
 Type 'git log' for more commits, or 'git show <commit id>' for full commit details.\n

After:

git info --no-config

## Remote URLs:

origin	https://github.com/sanusart/git-extras.git (fetch)
origin	https://github.com/sanusart/git-extras.git (push)
upstream	https://github.com/visionmedia/git-extras.git (fetch)
upstream	https://github.com/visionmedia/git-extras.git (push)

## Remote Branches:

  origin/HEAD -> origin/master
  origin/fix_feature_refactor_bug
  origin/gh-pages
  origin/issue234
  origin/master
  origin/patch-1
  upstream/gh-pages
  upstream/master

## Local Branches:

* master

## Most Recent Commit:

commit ac18bd16b4
Merge: 68455cf a1b7120
Author: hemanth.hm <hemanth.hm@gmail.com>

    Merge pull request #260 from brandondrew/patch-1

Type 'git log' for more commits, or 'git show <commit id>' for full commit details.
2014-10-06 21:59:53 +03:00

43 lines
717 B
Bash
Executable file

#!/bin/sh
get_config() {
git config --list
}
most_recent_commit() {
git log --max-count=1 --pretty=short
}
local_branches() {
git branch
}
remote_branches() {
git branch -r
}
remote_urls() {
git remote -v
}
# Show info similar to svn
echo
echo -e "## Remote URLs:\n"
echo -e "$(remote_urls)\n"
echo -e "## Remote Branches:\n"
echo -e "$(remote_branches)\n"
echo -e "## Local Branches:\n"
echo -e "$(local_branches)\n"
echo -e "## Most Recent Commit:\n"
echo -e "$(most_recent_commit)\n"
echo -e "Type 'git log' for more commits, or 'git show <commit id>' for full commit details.\n"
if test "$1" != "--no-config"; then
echo -e "## Configuration (.git/config):\n"
echo -e "$(get_config)\n"
fi