Repo specific ignore files in git

2019-01-25 19:59发布

Is it possible to have repo specific .gitignore files? Eg:

[origin] .gitignore:

  • foo1.*
  • foo2.*

[another] .gitignore:

  • bar1.*
  • bar2.*

The purpose behind this is that we deploy using git on to a managed cloud service and we'd like to keep dev files in version control but not push them to a repo.

标签: git gitignore
3条回答
太酷不给撩
2楼-- · 2019-01-25 20:26

You could probably do this using git hooks (the scripts in .git). post-checkout sounds good.

查看更多
Explosion°爆炸
3楼-- · 2019-01-25 20:29

Yes you can, just can't have them in the same folder. If you create a new folder, day "deploy" and publish your deploy data there, it will use the .gitignore in that folder (not the root one).

查看更多
放荡不羁爱自由
4楼-- · 2019-01-25 20:38

Yes, you can put per repository ignore patterns in .git/info/exclude in each repository.

(Note, this only affects what is ignored in each repository, it won't affect files that you actively place under source control and the push. I'm not completely clear on your desired use case.)

查看更多
登录 后发表回答