リモートブランチを削除する
git push origin :{remote branch name}
これでリモートブランチを削除できる
例)developというリモートブランチを削除する
$ git branch -a develop * master remotes/origin/HEAD -> origin/master remotes/origin/develop remotes/origin/master $ git push origin :develop $ git branch -a develop * master remotes/origin/HEAD -> origin/master remotes/origin/master
GitHubで消えていることが確認できた。追跡ブランチも消えてくれるのいいね
2017/10/04 追記
git push origin :{remote branch name}
では追跡ブランチは削除されていなかった!!
git branch -vv
で確認したところ、追跡ブランチは存在していた
git push origin :develop 実行前
$ git branch -vv * develop 6a0da68 [origin/develop] update hello.txt master 8b1dd7d [origin/master] add hello.txt
developはorigin/developを追跡していることがわかる
git push origin :develop 実行後
$ git branch -vv * develop 6a0da68 [origin/develop: gone] update hello.txt master 8b1dd7d [origin/master] add hello.txt
ん??origin/develop: gone
って何!!!developリモートブランチがないよ!ってことかな?存在しないリモートブランチを追跡しようとしているため、このような表示になっているのかも
developブランチがorigin/developを追跡しないようにする
git branch --unset-upstream
を実行すれば追跡をやめることができる
$ git branch --unset-upstream $ git branch -vv * develop 6a0da68 update hello.txt master 8b1dd7d [origin/master] add hello.txt
origin/develop: gone
がでなくなった!!!