mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
[Plugin] Git: Implemente a git info.
This commit is contained in:
parent
9369d19c02
commit
6cd297c91f
1 changed files with 41 additions and 0 deletions
|
|
@ -41,6 +41,47 @@ function current_branch() {
|
|||
echo ${ref#refs/heads/}
|
||||
}
|
||||
|
||||
function git-info() {
|
||||
# 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 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
|
||||
}
|
||||
|
||||
# these aliases take advantage of the previous function
|
||||
alias ggpull='git pull origin $(current_branch)'
|
||||
compdef ggpull=git
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue