LoginSignup
0
0

More than 3 years have passed since last update.

ローカルで今いるブランチ以外を削除する

Last updated at Posted at 2021-03-17

こんな感じ

$ git branch -D `git branch | sed '/*/d' | tr '\n' ' '

sed '/*/d'で、現在いるブランチを一覧から削除

$ git branch
  feature/1
  feature/2
  feature/3
  feature/4
  feature/5
* master

$ git branch | sed '/*/d'
  feature/1
  feature/2
  feature/3
  feature/4
  feature/5

この出力をgit branch -Dに渡す

$ git branch -D `git branch | sed '/\*/d'`'
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