ScoobaSteve
ScoobaSteve

Reputation: 583

Using github for a very large website

I'm a bit of a novice with Git so I'm hoping someone can help here. I am new to a project that has been going on for quite some time using Git. It's a HUGE website with thousands upon thousands of images, pdfs, etc. The files for this website have been ignored using gitignore. These files however are required for the website to run. I'm able to manually download and add them to the current branch I'm working on and the website runs. However, when I switch branches, I lose all the files. As far as I know, this is the expected behavior of Git. However, do I have to manually add these files every time I switch to a different branch that hasn't had these files added yet?

I hope this question makes sense. Thanks!

Upvotes: 0

Views: 207

Answers (3)

neurite
neurite

Reputation: 2824

This may be off the track. But wouldn't it make more sense to host the static content separately from the source code? Not only does this make development a lot easier -- you can focus on code instead of missing images, but also makes deployment a breeze. And from the user's perspective, this usually means improved performance. For one, the web app does not need to handle that many requests for images any more. Secondly, the image host can be specially optimized with CDN to delivery such staff more efficiently. Thirdly, images not part of the deploy will be more likely cached on the client side.

Upvotes: 2

tom
tom

Reputation: 2365

You're looking to solve the symptom of a problem rather than the problem itself. I would personally put all the images in a git submodule.

See https://softwareengineering.stackexchange.com/questions/80962/should-images-be-stored-in-a-git-repository for more suggestions.

Upvotes: 0

Arnaldo Capo
Arnaldo Capo

Reputation: 188

If you are ignoring the folder, I think it shouldn't go away. Make sure you do a git rm -r --cached . in the root and then git add .

Upvotes: 0

Related Questions