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?

.DS_Storeをすでにコミットしてしまった人向け対処法

1
Posted at

TL;DR

世の中にあるのは、大体これから.DS_Storeを追跡させないように.gitignoreをいじる記事が大半で、すでにコミットしてしまった状態から入れる保険がないので調べた。

git filter-repoを使って履歴からも全部消す方法です。

コマンド

$ echo .DS_Store >> .gitignore

(適当にコミットする)

$ git rm --cached .DS_Store
$ git filter-repo --path .DS_Store --invert-paths --force

結構荒いコマンド叩いてるので、チーム開発の時はポリシーをよく確認してください。

filter-repoがない場合

git: 'filter-repo' is not a git command. See 'git --help'.

とエラーが出たときは、git-filter-repoをインストールする。macOSの人はbrewで一発。

$ brew install git-filter-repo

他のプラットフォーム使ってる人はこっち見てください。

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?