LoginSignup
0
0

gitブランチが壊れた時の対処法

Posted at

ブランチが壊れてしまった

masterブランチに移ろうとしたら、以下のエラーが出てしまい、移動することができなくなってしまった。

git switch master fatal: bad object refs/heads/mobileToPC 2

これは、mobileToPC 2の名前が問題で、スペースが含まれていることが問題であった。
Gitではブランチにスペースを含めることができない。そのため、このブランチを削除する必要がある。

以下のコマンドをうち、ブランチを削除する。
git update-ref -d "refs/heads/mobileToPC 2"

*このコマンドを実行する時は、削除するブランチではないブランチで行うことがマスト!

gitブランチが壊れた時、参考になる記事

0
0
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
0
0