LoginSignup
2
6

More than 5 years have passed since last update.

GitHubでのブランチの削除

Posted at

誤ってブランチをつくてしまった場合にブランチを削除するコマンド。

ブランチの削除

ブランチを削除するには、branchコマンドに -d オプションを指定して実行します。

$ git branch -d <ブランチの名称>

issue1ブランチを削除するには、次のコマンドを実行します。

$ git branch -d chat_picture

Deleted branch chat_picture (was ea4afee).
これで、chat_pictureブランチは削除されました。branchコマンドでブランチが削除されたかを確認してみましょう。

$ git branch
* master

エラーが出た場合

以下のようなエラーが出てしまった対処を記載します。

error: Cannot delete branch 'chat_picture_create' checked out at '

これは作業中のブランチがありますよ。ということを言っているので選択しているブランチをmasterに戻してから、再度コマンドを入力してみます。

Deleted branch chat_picture_create (was ea4afee).

無事に削除できました。

2
6
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
2
6