git-rename-branch: Don't fail if remote doesn't exist

Allows the command to work correctly with local branches.

Closes #535
This commit is contained in:
Orestis 2018-09-13 15:15:03 +03:00 committed by GitHub
parent 2590998ee0
commit 7393fb41ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,7 @@ test -z $1 && echo "new branch name required." 1>&2 && exit 1
new_branch="$1"
old_branch="${2-$(git symbolic-ref --short -q HEAD)}"
remote=$(git config branch."$old_branch".remote)
remote=$(git config branch."$old_branch".remote; true)
git branch -m "$old_branch" "$new_branch"
# check if the branch is tracking a remote branch