LoginSignup
1
1

More than 5 years have passed since last update.

現在のブランチと同名のリモートブランチを除いたローカルブランチを削除するワンライナー

Last updated at Posted at 2016-02-17
LIST=`git branch -r |cut -d/ -f2 | grep -v HEAD`; for b in `git branch -l | grep -v "*"`; do [[ $LIST =~ $b ]] && echo $b 'is exists in remote' || echo git branch -D $b ;done

リモートブランチはプルリをマージしたあとに消すようにしているが、
ローカルは放置してしまいがちなので楽に消す方法ないかなと思って作成したみた。

ちなみに動作確認はしてません。。

もっといい方法ありましたらご教授お願いいたします。

1
1
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
1
1