LoginSignup
3
2

More than 5 years have passed since last update.

.gitignore以外でファイルを除外する

Posted at

概要

gitを使って開発をしていて、gitの管理対象外とするファイルを.gitignoreで管理することがほとんどだと思う。
ただ、チームで開発している場合、.gitignoreは全員で共有するファイルなので、個人的に含めたくないファイルやディレクトリがある場合は、毎回手動で除外するのは面倒。

対象のリポジトリに限定して、特定のディレクトリやファイルを除外する(しかも影響範囲は個人)

方法

対象のリポジトリのプロジェクトルートディレクトリで、以下を実行

$ vim .git/info/exclude
.git/info/exclude
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
public/uploads/  ←これでpublic/uploadsは自分の環境でのみ対象外になる
3
2
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
3
2