How to ignore some files in release with GIT
Asked Answered
B

1

7

I develop a core for our Nette web projects. The core is injected as a library. Although I want to be able to test and try the functionalities of the core project without injecting it. So I had to add files needed to start the core project separately. This is really helpful while trying out new features, but I do not want to include these files in a release (but still be able to share on git, so colleagues can try it, too).

Are there any good practices how to deal with this situation?

I only found two options:

  1. Do not commit these files into Git repository and share the files with colleagues through other repository - but here comes the compatibility problems.
  2. Commit these files to Git and have a separate branch for release in which these files are deleted.
Blackheart answered 27/4, 2018 at 9:41 Comment(4)
What's wrong with your branch solution? It looks good and easy to manage to me.Coverage
Sub-Modules? See this git-scm.com/book/en/v2/Git-Tools-SubmodulesMixon
To be honest I have a terrible experience with sub-modules. Why your company shouldn't use git submodules may be worth a read.Coverage
I have the same experience as @kabanus. Submodules aren't the best solution (slopjong.de/2013/06/04/git-why-submodules-are-evil)Intumesce
R
15

You may use export-ignore feature for this. Add this to your .gitattributes file:

/path/to/file/or/directory export-ignore

export-ignore

Files and directories with the attribute export-ignore won’t be added to archive files. See gitattributes for details.

Redtop answered 27/4, 2018 at 12:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.