LoginSignup
10
10

More than 5 years have passed since last update.

Git ブランチとタグの削除に関する備忘録

Posted at

※ Gitのバージョンによっては実行できる/出来ないがあるので注意

ブランチを削除する(ローカル)

# git branch -d test

強制的に消す時は

# git branch -D test

タグを削除する(ローカル)

# git tag -d tag

ブランチを削除する(リモート)

# git push origin :test

または

# git push --delete origin test

タグを削除する(リモート)

# git push origin :refs/tags/tag

または

# git push --delete origin tag

リモートリポジトリから削除されているリモートブランチを削除する

# git remote prune origin

または

# git fetch --prune

複数のブランチ(タグ)を一括で削除する

・ブランチ

# git branch | grep test | xargs git branch -D

・タグ

# git tag | grep tag | xargs git tag -d
10
10
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
10
10