Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.