2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

gitのリモートブランチを一括で整理する

Last updated at Posted at 2014-12-01

git-flowを使ってるけど、コマンド使ってない人や急ぎの修正でゴミブランチが溜まるので、マージ済みやつ一回で消すやつ用意した。

git branch -r --list --merged | grep -v '*' | grep -v 'master\\|develop' | awk '{ print $1 }' | sed -e 's/origin\///' | xargs -I % git push origin :%

使用する場合は注意して下さい!
pushする前に対象テーブルが問題ないかチェックする。

git branch -r --list --merged | grep -v '*' | grep -v 'master\|develop' | awk '{ print $1 }' | sed -e 's/origin///'

やっと後はチームに通知
git remote prune origin
git fetch --prune

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?