git: ブランチを変更・削除する

変更

git branch -m <ブランチ名>
git branch -m new_branch

自分が作業をおこなっているブランチの 名前を変更する。

削除

git branch -d <ブランチ名>

# 例
git branch -d feature

#強制削除する場合
git branch -D <ブランチ名>

-dは優しい削除と言われており、masterにマージされていない変更が残っている場合は削除せず、警告してくれる。