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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user