Skip to content

Instantly share code, notes, and snippets.

@notbrain
Created August 22, 2019 00:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notbrain/e9961a810e5d0ed42665a3d345bf3486 to your computer and use it in GitHub Desktop.
Save notbrain/e9961a810e5d0ed42665a3d345bf3486 to your computer and use it in GitHub Desktop.
OLD_BRANCH=$(git rev-parse --abbrev-ref HEAD)
NEW_BRANCH=$1
git branch -m $OLD_BRANCH $NEW_BRANCH # Rename branch locally
git push origin :$OLD_BRANCH # Delete the old branch
git push --set-upstream origin $NEW_BRANCH # Push the new branch, set local branch to track the new remote
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment