I've obtained a client that has a website th开发者_StackOverflow社区at I want to put under git source control. But it's really, really horribly coded and that's getting in the way of putting it under source control.
Usually, when I put an existing website under source control, I set .gitignore
to ignore all variable data and only add the code. Anything that linux would put into /var
. In a website, that usually includes a "data" folder where the dynamic images are stored, and a "temp" dir that holds logs, caches, etc.
Anyway, this site that I'm working with now has a lot of files that could be categorized as both:
- When the admin saves a page in his CMS, actual template files are written: The code looks for a
<!-- INSERTSTART -->
and<!-- INSERTEND -->
and inserts in between (Yuck) - It inserts dynamic and user-uploaded images and files in the same exact directory as the static ones. Not even in a subdirectory
- There's a routing config file that's written to using
<!-- INSERTSTART -->
and<!-- INSERTEND -->
comments too. - There's a javascript file that includes the navigation bar link tree that gets written as well.
I'm sitting here staring at an empty .gitignore thinking, what now? If I ignore all of the files, I'll be missing code in my repo. But if I am too lax, I'll be constantly having to add data to the repo.
I think your only choice is to put everything in the repository for now (because you can't lose anything) and then work on refactoring the structure so that it fits your preferred pattern.
精彩评论