変更方法
git-spiceでブランチ名を変更するには、gs branch rename
コマンドを使用します。
指定したブランチの名前を変更
既存のブランチ名を新しい名前に変更するには以下のようにします。
gs branch rename <old-name> <new-name>
例:
gs branch rename feature-old feature-new
現在のブランチ名を変更
現在チェックアウトしているブランチの名前を変更には以下のようにします。
gs branch rename <new-name>
例:
gs branch rename feature-improved
インタラクティブに変更
プロンプトを使って対話的にブランチ名を変更には以下のようにします。
gs branch rename
git-spiceが現在のブランチ名の変更をインタラクティブに案内してくれます。
コマンドエイリアス
gs branch rename
は以下の短縮形でも実行できます。
gs branch rn
gs branch mv
# これらは全て同じ動作をします
gs branch rename feature-old feature-new
gs branch rn feature-old feature-new
gs branch mv feature-old feature-new
git branch -m を使った場合の対処
通常のGitコマンド(git branch -m
)でブランチ名を変更した場合、git-spiceはその変更を自動的に認識しません。この場合は、以下のコマンドを使用してブランチのトラッキング状態を手動で更新する必要があります。
# 古いブランチ名のトラッキングを解除
gs branch untrack <old-branch-name>
# 新しいブランチ名でトラッキングを開始
gs branch track <new-branch-name>
参考