make gup an alias, move function to ~/bin
This commit is contained in:
parent
1a7617f16d
commit
45cd33c3c3
1 changed files with 1 additions and 15 deletions
16
zsh/zshrc
16
zsh/zshrc
|
|
@ -233,6 +233,7 @@ if command_exists git; then
|
||||||
alias gl='git log'
|
alias gl='git log'
|
||||||
alias glo='git log --oneline --decorate'
|
alias glo='git log --oneline --decorate'
|
||||||
alias gls='git log --stat'
|
alias gls='git log --stat'
|
||||||
|
alias gup='git update'
|
||||||
alias m='git merge'
|
alias m='git merge'
|
||||||
alias s='git status -sb'
|
alias s='git status -sb'
|
||||||
alias st='git stash'
|
alias st='git stash'
|
||||||
|
|
@ -240,21 +241,6 @@ if command_exists git; then
|
||||||
alias stp='git stash pop'
|
alias stp='git stash pop'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function gup() {
|
|
||||||
BRANCH=$(git branch --no-color --list | grep '^\*' | awk '{print $2}')
|
|
||||||
if [[ "$BRANCH" != "(detached" ]]; then
|
|
||||||
STASH_OUTPUT=$(git stash)
|
|
||||||
if [[ "$STASH_OUTPUT" = "No local changes to save" ]]; then
|
|
||||||
POP_STASH=0
|
|
||||||
else
|
|
||||||
POP_STASH=1
|
|
||||||
fi
|
|
||||||
git fetch --prune --tags origin && git rebase "origin/$BRANCH" && ([[ $POP_STASH -eq 1 ]] && git stash pop) || true
|
|
||||||
else
|
|
||||||
echo "Cannot update in a detached HEAD state"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# `cd /path/to/a/file` does `cd /path/to/a`
|
# `cd /path/to/a/file` does `cd /path/to/a`
|
||||||
function cd () {
|
function cd () {
|
||||||
if [[ -f "$1" ]]; then
|
if [[ -f "$1" ]]; then
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue