LoginSignup
6
6

More than 5 years have passed since last update.

Gitでcheckoutできなくなった時にやったこと

Posted at

現象

SmartyのCacheファイルをcommitしてしまったのが原因で、checkoutしようとしたら以下のエラーがでた。

error: unable to create file file.hoge.html.php
fatal: Could not reset index file to revision 'HEAD'.

解決法

commit済みのCacheファイルを.gitignoreしてcheckoutする。

# Cacheファイルのパスを書く
$ vim .gitignore
$ git add .gitignore
$ git commit -m "add .gitignore"
$ git chechout yourbranch
6
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
6
6