Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.gitignore specific to subrepo #596

Open
fherreazcue opened this issue Sep 19, 2023 · 1 comment
Open

.gitignore specific to subrepo #596

fherreazcue opened this issue Sep 19, 2023 · 1 comment

Comments

@fherreazcue
Copy link

fherreazcue commented Sep 19, 2023

Is it possible to ignore files for the subrepo commits/pushes, but not ignore them in the main repo?

I am using git subrepo to re-use code that generates files based on some templates. The templates live in the subrepo (S), and the subrepo lives in multiple bigger repos (R1, R2...) with different directory structures.
The workflow is generally to pull S from R*, run a script (which also lives in S) to generate a bunch of R* specific files, and then push these files to R*.
This would be fine if S was "read only", but if you ever try to push to S, all of the R* specific files are pushed, and eventually cloned into the other R* repos. I want to be able to ignore those files in S commits, say by having a .gitsubrepoignore file or config value.
Also, on a force pull all the local R* specific files get deleted... for my use case that is kind of ok, but it may not be for others...

I found a couple of issues (#437 & #64) that touch on a feature I could not find how to work, and I believe those issues refer more to ignoring files when pulling a subrepo only.

@admorgan
Copy link
Collaborator

No, git subrepo does not have a mechanism to ignore files other than .gitignore. Therefore it would not be possible to have files committed to the S directory in R but not pushed to S. This is also a feature I am not interested in implementing. I always look at patches, but I am not inclined to be excited about this one.

I obviously don't have any information about your projects, but I would store the output in a directory in R that does not overlap the S directory. Then you have the tools to generate them, but not trying to filter the output. To be honest in my work projects I don't allow committing the output of something that can be compiled (I count scripts that generate output of any sort as compiling).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants