Last active
December 9, 2016 07:39
-
-
Save imesh/50e1a2c7ebeccc8ffb0776f27d96bc17 to your computer and use it in GitHub Desktop.
Rename a Git branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
old_name="old-branch-name" | |
new_name="new-branch-name" | |
git checkout ${old_name} | |
git branch -m ${old_name} ${new_name} | |
git push origin :${old_name} ${new_name} | |
git push origin -u ${new_name} | |
echo "Branch ${old_name} renamed to ${new_name}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment