Jump to content

How do you use GIT with PW?


benbyf
 Share

Recommended Posts

Feel like this is a perennial question and probably a duplicate...BUT I have a load of new PW sites and in the past I've git'ed on the template/ folders to gitlab, bitbucket, github or similar.

What are people doing to version control with PW as I would love to add more than the templates folder ideally (as I often make custom Modules) but wondered what people's strategies are?

Link to comment
Share on other sites

Might be easier to tell what I exclude which is:

  •  /site/assets
  •  /vendor
  • multiple things like "site/modules/ComposerModule" , example of any module that I manage through composer rather than git.
  • .env - I do this to be able to include config.php in version control.

On my todo is to try: https://github.com/uiii/processwire to also handle PW core as a composer dependency. 

 

  • Like 1
Link to comment
Share on other sites

I add to Git site and wire. On wire I have some Git patches that I may apply again after updating to a new version, and each wire version may solve or add bugs, so I add it to version control.

So .gitignore files exclude vendor directory and :

Quote

site/assets/cache/**/
site/assets/cache/*.maint
site/assets/sessions/sess_*
site/assets/logs/*.txt
site/templates/css/*.css
site/templates/css/*.map

I need some files in assets, so I exclude everything that is not needed and keep the rest.

I also add the database.sql to Git, a clean version ready to be deployed on a new site. Everytime I do changes in admin I export the DB.

  • Like 3
Link to comment
Share on other sites

I add Git in the root folder and can recommend GitKraken as app. 😀

I have a develop and a master branch and an upstream remote. Our remote repositories are hosted on Bitbucket.

This is my current .gitignore file:

Spoiler
# OS
.DS_Store

# Visual Studio Code
/.vscode/
/*.code-workspace

# CodeKit
/config.codekit3
/.sass-cache

# Node
node_modules/

# Apache
/.htaccess

# Composer
/composer.lock
/vendor/

# ProcessWire
/site/config.php
/site/config-dev.php
/site/assets/

# SEO
/robots.txt
/googlec*.html
/BingSiteAuth.xml

Regards, Andreas

Edited by AndZyk
  • Like 2
Link to comment
Share on other sites

I use Git in the project root as well, and only put things in .gitignore I really don't want to have in that repo.

Best case scenario is that I have the full project, besides database dumps, in my repo.

# .gitignore
.ddev/
site/assets/backups/
site/assets/cache/
site/assets/logs/
site/assets/ProCache-*
site/assets/pwpc/
site/assets/sessions/
site/config-dev.php

Database dumps are a thing of its own. Managed projects are backed up quite often, long time projects with not that many updates will be backed up once every 3 months. From un-Managed projects I keep only the latest version I worked on - most of the time the release day or when something was updated.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...