add a gup command to update a local git branch from its remote origin branch
This commit is contained in:
parent
cad264db25
commit
44235defb8
1 changed files with 10 additions and 0 deletions
10
zsh/zshrc
10
zsh/zshrc
|
|
@ -233,9 +233,19 @@ if command_exists git; then
|
||||||
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'
|
||||||
|
alias stl='git stash list'
|
||||||
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
|
||||||
|
git stash && git fetch origin && git rebase "origin/$BRANCH" && git stash pop
|
||||||
|
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