0
0

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 3 years have passed since last update.

master にマージ済みのローカルブランチを全部消す

Posted at
for i in $(git branch | grep -v '\*') ; do git branch -d $i ; done
  1. git branch でブランチ一覧を取得
  2. grep -v '\*' で現在のブランチ(master)を除外
  3. for で一つのブランチずつ、 git branch -d ブランチ名 していく

マージしていないものは、以下のようなエラーで失敗するので問題ない。

error: The branch 'foobar' is not fully merged.
If you are sure you want to delete it, run 'git branch -D foobar'.
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?