1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Git LFSで消えない差分が出続けた時の対処法

Posted at

問題

  • gitで変更していないファイルの差分が出てしまう
  • git reset --hard HEAD しても差分が消えない

上記のような問題が発生し困っていました。

解決方法

Git LFSの設定は .gitattributes に記載があります。
こちらに差分のあるファイルの拡張子が記載されていたので、該当行を削除すると、gitの差分が消えました。

  1. .gitattributes から差分の出ているファイルの設定を一時的に削除(行頭に#を書くとその行をコメントアウトできます)
  2. gitのdiffから消えていることを確認
  3. .gitattributes の設定を戻す

一度、差分が消えた後は再度 .gitattributes の設定を元に戻しても差分が出ることはありませんでした。
同じようにGit LFSを使っている方でGitで差分が消えずに困っている方は一度上記の手順を試してみてはいかかでしょうか。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?