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 1 year has passed since last update.

不要なブランチを削除する

0
Posted at

背景

  • git branch を叩くとたくさん出てくる

現在の姿

  • 不要なブランチが表示されており良くない

改善手順

■ 各ブランチの最終更新日とコミット内容を一覧で出力する。
■ 長期更新されていないものは削除候補と考える。
$ git for-each-ref --format='%(refname:short) %(committerdate:relative) %(subject)' refs/heads

■ ローカルブランチ一覧を表示
$ git branch

■ リモートブランチ一覧を表示
$ git branch -r

■ リモートブランチの不要な情報をクリーンアップ
# git fetch -p

■ マージ済みのローカルブランチを確認
■ main に統合済みかチェック
# git branch --merged main

■ 不要なブランチを削除(例: faeature/vpc)
git branch -d faeature/vpc
git branch

■ 不要なリモートブランチも削除
git push origin --delete faeature/vpc
git branch -r
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?