Gitで無視するファイルを設定する

gitの操作(addやstatus)で特定のファイルを無視するには、リポジトリのルートディレクトリに.gitignoreファイルを設定すればよい。

ただし以下の点に注意。

  • .gitignore自体をadd/commitしないと効果は現れない
  • 一度commitしたファイルはあとから無視設定をしても効果がない(一旦リポジトリから削除する必要がある)(gitignoreでハマる

以下、自分の設定内容をメモっておく。

Xcodeで作成したプロジェクト

*.DS_Store
profile
build/*
*.pbxuser
*.mode1v3

buildディレクトリ以下の更新内容は無視して構わない(と以前どこかで読んだ)。あとはnib/xib以下にできるバックアップファイルとか、Finderの設定ファイルとか。

Stack Overflowにもいろいろな例があがっている(そこからgistを作った人もいる)。

Rails

Railsアプリをgitで管理するときのやり方を参考にするとよさそう。


Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <img localsrc="" alt="">