Skip to content

Instantly share code, notes, and snippets.

@ashwin
Created October 12, 2017 15:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashwin/63aa43d6e74f5969f7620f2b3a1981e1 to your computer and use it in GitHub Desktop.
Save ashwin/63aa43d6e74f5969f7620f2b3a1981e1 to your computer and use it in GitHub Desktop.
Git script to rename remote branch
#!/bin/sh
# From: https://github.com/sschuberth/dev-scripts/
if [ $# -ne 3 ]; then
echo "Rationale : Rename a branch on the server without checking it out."
echo "Usage : $(basename $0) <remote> <old name> <new name>"
echo "Example : $(basename $0) origin master release"
exit 1
fi
git push $1 $1/$2:refs/heads/$3 :$2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment