1
0
mirror of https://github.com/robbyrussell/oh-my-zsh.git synced 2025-12-07 07:50:40 +01:00

git: add grename to rename a local branch and in the origin remote (#8622)

Co-authored-by: Marc Cornellà <marc.cornella@live.com>
This commit is contained in:
Ujwal Dhakal
2020-02-19 01:50:52 +05:45
committed by GitHub
parent d49397a01d
commit e8609b857c
2 changed files with 193 additions and 178 deletions

View File

@@ -256,3 +256,17 @@ alias glum='git pull upstream master'
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"'
function grename() {
if [[ -z "$1" || -z "$2" ]]; then
echo "Usage: $0 old_branch new_branch"
return 1
fi
# Rename branch locally
git branch -m "$1" "$2"
# Rename branch in origin remote
if git push origin :"$1"; then
git push --set-upstream origin "$2"
fi
}