mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
- 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 commitac18bd16b4Merge:68455cfa1b7120Author: 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: commitac18bd16b4Merge:68455cfa1b7120Author: 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.
43 lines
717 B
Bash
Executable file
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
|