Skip to content

Instantly share code, notes, and snippets.

@organom
Created October 4, 2023 18:47
Show Gist options
  • Save organom/06abec04c7eebe325b6c206538fab7ef to your computer and use it in GitHub Desktop.
Save organom/06abec04c7eebe325b6c206538fab7ef to your computer and use it in GitHub Desktop.
Renames a git branch
!#/bin/bash
function git-rename() {
if [ $# -lt 2 ]
then
echo "Usage: $0 old_branch_name new_branch_name";
else
git branch -m $1 $2
git push origin :$1 $2
fi
}
git-rename $1 $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment