Skip to content

Commit

Permalink
Merge pull request #635 from spacewander/fix_rename_branch
Browse files Browse the repository at this point in the history
fix syntax & name variables better in rename-branch
  • Loading branch information
hemanth authored Mar 7, 2017
2 parents b0ba3e5 + cc0dff2 commit b00aace
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions bin/git-rename-branch
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
# 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
new_branch="$1"
old_branch="${2-$(git symbolic-ref --short -q HEAD)}"

git branch -m $2 $1
git push origin :$2
git push --set-upstream origin $1
git branch -m "$old_branch" "$new_branch"
git push origin :"$old_branch"
git push --set-upstream origin "$new_branch"

0 comments on commit b00aace

Please sign in to comment.