What Is The Best Way To Maintain A Custom Cs-Cart Site Via Git?

I am novice with Git. I have experience with commits, branches, merges, such, but not really the advanced stuff.

I am trying to figure out a good way to handle putting our customized CS-Cart in Git.

Should I just make repositories for the addons and the theme? and what about the rest of the structure? How should I deal with that?

Thanks :)

I would also like to know more about versioning CS-Cart installations with Git.

I would suggest 3 possible solutions:

  1. Small project

    If you develop some add-ons or themes than it would be better to store only folders of you project (addon/theme) in the repository.

  2. Big project with core files changes

    In case you will modify core files (although it is not recommended in big projects it can be) - i would advise you to store all the CS-Cart files in a git repository.

  3. Complex projects with long live support

    More complex solution that we use for some of the projects is merge of 1) & 2) points above. for example we want store my_changes in a git repository and CS-Cart installation in another git repository.

    Here is what we should do

    [indent=1]Move all the folders of my_change out of the CS-Cart installation directory.[/indent]

    [indent=1]e.g. we have installation of CS-Cart in /var/www/example.com

    than we should create a new folder /var/www/addons

    and move all the addon folders to it (make sure the directory tree remains the same:

```php >mkdir -p /var/www/addons/my_changes/app/addons

mv /var/www/example.com/app/addons/my_changes /var/www/addons/my_changes/app/addons

mkdir -p /var/www/addons/my_changes/design/backend/templates/addons/

mv /var/www/example.com/design/backend/templates/addons/my_changes /var/www/addons/my_changes/design/backend/templates/addons/

…etc for all the my_changes folders that exist in the installation ```

Now you need to link the files from the /var/www/addons folder to your installation. Here are the actions:

```php >cd /var/www/example.com/app/addons

ln -s /var/www/addons/my_changes/app/addons/my_changes my_changes

cd /var/www/example.com/design/backend/templates/addons

ln -s /var/www/addons/my_changes/design/backend/templates/addons/my_changes my_changes

… etc ```

Go to the cs-cart installation and initialize it as a git repository

```php >cd /var/www/example.com

git init ```

Go to the addons folder and initialize it as a git repository

```php >cd /var/www/addons

git init ```

That's it - now you have two repositories one for CS-Cart installation and another for my_changes add-on. You can store as many addons in the addons repository as you need.[/indent]

Thanks Ilya. That makes sense. It's similar to the way I've done things with Wordpress and Drupal.

Another question... How would we handle CS-Cart updates that require database changes? If I perform updates on my test server, commit to git, and pull those updates to the live server, would CS-Cart on the live server realize that database updates are required?