I have used https://github.com/drupal-composer/drupal-project to install a new website. I have now updated the core with the same information on the above link.

I was wondering where the backups are stored and how to use the "git diff" because I don't now where the old vs new files are located on my server (ie: .htaccess and robots.txt).

  • 1
    What do you mean by “backups” exactly? The Drupal composer project is just an installation script, it doesn’t keep backups (there’s no way it could). If you have your changes in git then just use whatever method you like to review the diffs, otherwise you’ll need to fall back to whatever general backup system you have in place – Clive Aug 13 '18 at 8:44
  • In the past I have always installed my drupal sites with drush, but this isn't the recommended way anymore. If I used "drush up drupal" it first created a backup... – user3086053 Aug 13 '18 at 12:17
  • 1
    Yeah that’s a completely different thing, Composer can’t backup your website (well it technically could, but it wouldn’t make any sense for it to be able to do it). Drush isn’t used for downloading modules/themes anymore, and as archive-dump has been removed, it doesn’t do backups any more either. Drupal 8 is much more “do it to your own (or industry) general best practices, not how we tell you to do it”. Which is a good thing, but it means you have some work to do and thinking to shift when you move from 7 to 8 – Clive Aug 13 '18 at 12:24

The guide you are referring to assumes that you will be tracking your website as a git project. This is the best way to develop locally before deploying on the server.

The workflow for that is to use composer create-project, then initializing the git repository and adding everything. The default .gitignore should ensure that the installed code isn't added. However, the scaffolding files like index.php and autoload.php are. Once that is done, you can deploy the site on any server by cloning the repository and running composer install.

When the guide says that after updating you should

Run git diff to determine if any of the scaffolding files have changed. Review the files for any changes and restore any customizations to .htaccess or robots.txt.

it means that updating may have replaced these files, and you may need to re-add custom changes and then commit the new files to git.

composer doesn't create any "backups" when overwriting the scaffolding files - this is why it is important to track the scaffolding files in git, especially if you have custom modifications.

  • This guide is downloading the files/modules needed to install Drupal 8. So far so good. I understand that Git is some way of versioning like SVN I've used in the past, where you can commit new edited files? While Drupal is updating its core and other modules frequently it is not recommended to update locally and then upload the whole stuff on the webserver? This takes to much time. So what is the best practice? – user3086053 Aug 13 '18 at 13:00
  • 1
    Yes indeed - git is a versioning tool that, at its core, works locally (you can track changes in a folder without any server). There is more info at git-scm.com/book. And sure, you can still deploy by uploading your site files (whether or not you use git). Though it is generally a good habit to push local changes to a remote repository (eg on GitHub or GitLab), then SSH into your server and run git pull / composer install. (Generally faster, and you aren't unintentionally uploading test data or files from the local environment.) – Christoph Burschka Aug 13 '18 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.