Skip to content

Instantly share code, notes, and snippets.

@walf443
Created January 9, 2013 06:54
Show Gist options
  • Save walf443/4491189 to your computer and use it in GitHub Desktop.
Save walf443/4491189 to your computer and use it in GitHub Desktop.
*[git]origin/masterへmergeずみのリモートブランチをまとめてお掃除したい。
** まとめ
>||
$ git fetch --prune
$ git fetch
$ git branch -r --merged origin/master | grep -v origin/master | sed -e 's/origin\//:/' | xargs echo git push origin
||<
** ポイント
- git fetch --pruneしないと、git branch -rの結果がリモートブランチと一致しないことがある。
- git branch -r --merged origin/masterで、origin/masterをベースに、mergeされたリモートブランチ一覧を得られるので、それを置換して、git pushでタグを消すコマンドをxargsで作る。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment