Unverified Commit e8609b85 authored by Ujwal Dhakal's avatar Ujwal Dhakal Committed by GitHub
Browse files

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


Co-authored-by: default avatarMarc Cornellà <marc.cornella@live.com>
parent d49397a0
This diff is collapsed.
......@@ -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
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment