Add git rename-branch
alias
* Extract `git current-branch` alias. * Re-use `git current-branch` in two places.
This commit is contained in:
parent
d874ae2cbc
commit
b0fe7c01ff
2 changed files with 5 additions and 3 deletions
|
@ -13,9 +13,11 @@
|
|||
co-pr = !sh -c 'git fetch origin pull/$1/head:pr/$1 && git checkout pr/$1' -
|
||||
create-branch = !sh -c 'git push origin HEAD:refs/heads/$1 && git fetch origin && git branch --track $1 origin/$1 && cd . && git checkout $1' -
|
||||
ctags = "!sh -c '[ -f .git/hooks/ctags ] || git init; .git/hooks/ctags' git-ctags"
|
||||
current-branch = !sh -c 'git rev-parse --abbrev-ref HEAD' -
|
||||
delete-branch = !sh -c 'git push origin :refs/heads/$1 && git branch -D $1' -
|
||||
merge-branch = !git checkout master && git merge @{-1}
|
||||
pr = !gh pull-request
|
||||
rename-branch = !sh -c 'old=$(git current-branch) && git branch -m $old $1 && git push origin --set-upstream $1 && git push origin --delete $old' -
|
||||
st = status
|
||||
up = !git fetch origin && git rebase origin/master
|
||||
[core]
|
||||
|
|
6
zshrc
6
zshrc
|
@ -1,8 +1,8 @@
|
|||
# modify the prompt to contain git branch name if applicable
|
||||
git_prompt_info() {
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null)
|
||||
if [[ -n $ref ]]; then
|
||||
echo " %{$fg_bold[green]%}${ref#refs/heads/}%{$reset_color%}"
|
||||
current_branch=$(git current-branch 2> /dev/null)
|
||||
if [[ -n $current_branch ]]; then
|
||||
echo " %{$fg_bold[green]%}%{$current_branch%}%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
setopt promptsubst
|
||||
|
|
Loading…
Add table
Reference in a new issue