Skip to content

Instantly share code, notes, and snippets.

@libitte
Last active December 18, 2015 15:19
Show Gist options
  • Save libitte/5802975 to your computer and use it in GitHub Desktop.
Save libitte/5802975 to your computer and use it in GitHub Desktop.
remote branch 削除方法

1

~/.gitconfigを作成

[alias]
  rmrf = !sh -c 'git branch -d $0 && git push origin :$0'

これをすると、指定したブランチが今いるブランチにマージされていればそのブランチを消して、さらに同名のoriginのブランチを消すというスグレモノ。

2

git push REMOTENAME :BRANCHNAME

でおk. よって、

git push origin :gomi_branch

みたいな感じで使う。

ref. https://help.github.com/categories/18/articles#deleting_a_remote_branch_or_tag

3

$ git branch -rd origin/hoge

でリモートブランチのみ消せる。 ローカルのブランチは別途git branch -d hogeなどで消す必要があるので注意。

http://qa.atmarkit.co.jp/q/2067

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment