diff options
Diffstat (limited to 'plugins/git/git.plugin.zsh')
-rw-r--r-- | plugins/git/git.plugin.zsh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 380ab76d8..ffb3e506a 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -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 +} |