LoginSignup
1
1

【Git】Gitのブランチに「&」を入れたら削除できなくなった件

Last updated at Posted at 2023-05-21

問題点

gitのブランチで下記のようなブランチ名を作成したら、削除できませんでした。
例) feature/add_view&controller

$ git push origin --delete feature/add_view&controller
[1] 19856
zsh: command not found: controller
error: unable to delete 'feature/add_view': remote ref does not exist
error: failed to push some refs to 'https://github.com/~'

[1]  + exit 1     git push origin --delete feature/add_view

どうやら「&」が入っていると、&より後ろのブランチ名(controller)がbashコマンドと見なされてしまっているようです。

対策

削除するときに、下記の形であれば削除できるようになりました。
単純にダブルクウォートで囲ってあげれば削除できました

ローカルブランチ
git branch -d "feature/add_view&controller"
リモートブランチ
git push origin --delete fix/authentication
1
1
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
1
1