We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a4af12a commit a41e2e8Copy full SHA for a41e2e8
bin/git-rename-branch
@@ -8,7 +8,8 @@ old_branch="${2-$(git symbolic-ref --short -q HEAD)}"
8
remote="$(git for-each-ref --format='%(upstream:short)' "refs/heads/$old_branch")"
9
10
git branch -m "$old_branch" "$new_branch"
11
-if [ -n "$remote" ]
+# check if the branch is tracking a remote branch
12
+if [[ -n "$remote" && "$remote" == */* ]]
13
then
14
remote=${remote%%/*}
15
git push "$remote" :"$old_branch"
0 commit comments