mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-20 03:02:29 +01:00
Merge eb0fed5cd6 into a8ef111a79
This commit is contained in:
commit
451aeb0b2c
1 changed files with 14 additions and 8 deletions
|
|
@ -125,17 +125,23 @@ alias gsd='git svn dcommit'
|
||||||
# Usage example: git pull origin $(current_branch)
|
# Usage example: git pull origin $(current_branch)
|
||||||
#
|
#
|
||||||
function current_branch() {
|
function current_branch() {
|
||||||
if [ ! -d .git ]; then return; fi
|
if [ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1; then
|
||||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||||
echo ${ref#refs/heads/}
|
echo ${ref#refs/heads/};
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function current_repository() {
|
function current_repository() {
|
||||||
if [ ! -d .git ]; then return; fi
|
if [ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1; then
|
||||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||||
echo $(git remote -v | cut -d':' -f 2)
|
echo $(git remote -v | cut -d':' -f 2);
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# these aliases take advantage of the previous function
|
# these aliases take advantage of the previous function
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue