mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 15:36:21 -04:00
fix syntax & name variables better in rename-branch
This commit is contained in:
parent
b0ba3e5346
commit
cc0dff2f49
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in a new issue