tj.git-extras/bin/git-rename-branch
2016-09-11 09:11:32 +05:30

14 lines
272 B
Bash
Executable file

#!/usr/bin/env bash
# Assert there is at least one branch provided
test -z $1 && echo "new branch name required." 1>&2 && exit 1
if [ -z $2 ]
then
$2=${git symbolic-ref --short -q HEAD}
fi
git branch -m $2 $1
git push origin :$2
git push --set-upstream origin $1