0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ローカルブランチを掃除しよう

Last updated at Posted at 2025-04-04

マージ済のローカルブランチを削除

対応が終わった大量のブランチを手元に残していませんか?
git branchで確認してみましょう。マージ済のブランチは↓で削除できます。

git branch ---merged | xargs git branch -d

各リリース(phase)のブランチは手元に残しておきたい等あれば適宜grepで除外します。

git branch ---merged | grep -v "phase" | xargs git branch -d

リモートに存在しないリモート追跡ブランチを削除

リモートで削除されたブランチは、いつまでも追跡しなくてよいので↓で削除できます。

git fetch --prune

このオプションをデフォルトで有効にすることも可能です。

git config --grobal fetch.prune true
0
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?