diff --git a/scripts/git-switch-remote-type b/scripts/git-switch-remote-type index 468b11e..ae21ea4 100755 --- a/scripts/git-switch-remote-type +++ b/scripts/git-switch-remote-type @@ -4,18 +4,18 @@ set -e origin=$(git remote get-url origin) if [[ $(echo "$origin" | awk -e '/https/') != "" ]]; then - git_url="git@$(echo "$origin" | cut -d "/" -f 3):/$($(echo "$origin" | cut -d "/" -f 4-))" + git_url="git@$(echo "$origin" | cut -d "/" -f 3):/$(echo "$origin" | cut -d "/" -f 4-)" else git_url="https://$(echo "$origin" | cut -d "@" -f 2 | cut -d ":" -f 1)/$(echo "$origin" | cut -d ":" -f 2 | cut -d "/" -f 2-)" fi git_branches=$(git branch | grep '*' | tr -d ' *') git remote remove origin -git remote add origin $git_url +git remote add origin "$git_url" git fetch echo "New git url $git_url, updating branches" for branch in $git_branches; do - git checkout $branch - git branch --set-upstream-to=origin/$branch $branch + git checkout "$branch" + git branch --set-upstream-to=origin/$branch "$branch" echo "Branch $branch configured to track on origin/$branch" done