Pickle Pickle - 1 year ago 168
Git Question

Git push full project, pull only distribution files

I have a big (to me) project with lots of files that are just used for development - for example, the full Bootstrap 4 source code. I use that source code to generate

bootstrap.css
and
style.css
.

I'd like to keep everything on my dev box and in the repository. but when I'm deploying to production, I don't need all those build
.scss
files, just the resulting
.css
. Is there a way to do that? A sort of
.gitignore
I can use when deploying to production, but ignore when merging from dev to git?

I'm only really interested if Git has this type of functionality built-in. This is a "like to do" not a "must do at any cost".

Answer Source

While I don't really recommend using git as a deployment tool, if it's what you're going to do then sparse checkout is probably the easiest way to get git to do what you want.

(Using a build tool to explicitly construct a deployment package is a far more flexible solution that's less likely to bite you in the rear later. I see where you've written that it's not what you want to do, but if I'm leaving this answer I'm including this caveat so you can't say I didn't warn you.)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download