LoginSignup
41
19

More than 5 years have passed since last update.

リモートで削除済みのブランチをローカルからも削除する

Last updated at Posted at 2017-04-12

他人が削除したリモートブランチが残っていて、削除できなかったときのメモです。

こんなときに使う

・masterにマージ済みで、削除されたはずのリモートブランチが git branch -a で出てくる
・ローカルブランチは git branch -D で削除済み
git push origin :hopeしても消えない
git fetchしても消えない

コマンド

git fetch --prune
または
git fetch -p

メモ

git fetch だけではリモートブランチを取り込むだけで削除はしません。
「--prune」「-p」というオプションを指定することで削除されたブランチも更新されます。

41
19
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
41
19